LookupPrintservices() gives default printer name alone...
Hello,
There are four printers in the network..operating system is LINUX ..when i run the program its showing only the default printer.
If i restart the cups service ,then its showing all the options.Why is it
so....
So each time when i open the application ,i have to restart the cups..Is this is right way?
Is there is any other optimistic way to show the printer options.
Following code
public static void main(String arg[])
PrintService[] services = PrinterJob.lookupPrintServices();
for(int i = 0 ;i < services.length;i++) {
System.out.println(i+":"+services.getName());
PrinterJob printerJob = PrinterJob.getPrinterJob();
if (printerJob.printDialog())
System.out.println("Printer is There... ");
PrintService service = printerJob.getPrintService();
System.out.println("printer Name = " +printerJob.getPrintService().getName());
Please help me to solve this....Urgent!!!!!!!!!!!!!!!
Message was edited by:
rithi_megaa
OK now it really doesn't make sense. Your code is exporting which has nothing to do with printing from the viewer...
So, create your own Print Button and handle the file name yourself then you can call it anything you want and it gets printed from the export file name. If that third party PDF printer driver has an API available then you could populate the name there.
Use your line of code: FileDest.DiskFileName = TextBox2.Text.ToString + " - Postage Report.pdf"
to set the file name for that PDF Printer.
Sorry it's really not clear what you are trying to do...
Don
Similar Messages
-
How to find windows default printer name
Hi Experts,
I have one requirement.....smartform should print in local default printer.
you might be known in windows we can set default printer name .
Suppose when the user executes my program, smartform should print in the default windows printer. not sap default printer. I tried by giving printer name as LOCL. In that case it is displaying pop-window by showing printer name. I don't want to see that pop-up window.
If I pass printer name in the smartform function module.. it is not displaying pop-up window and printing directly.
For this we need to findout what is the default printer of that particular system.
I think ... there will be method / FM to findout the front end default printer name...
Pls help me..
Thanks in advance
Raghu
Edited by: r badveli on Apr 17, 2009 4:46 AMHi Raghu,
Check the following tables to fetch the printer settings of a user.
TSPUSRSEL - Spool: User-Specific Settings
TSP03D Spool: Device Description (New Format)
So that you can use this detail and can fill the printer name.
Hope this will be useful.
Thanks,
Rajesh. -
Default Printer name in Smartforms
Hi Experts,
When I am displaying Smart forms, an automatic popus is getting displayed which asks for current Printer.I am using LP01 as default printer.Can I hide this popup so while the user executes the program,he can directly view the Report screen.
regds,
Sam.DATA : LF_FORMNAME TYPE TDSFNAME , " Smart Forms: Form Name
LF_FM_NAME TYPE RS38L_FNAM. " Name of Function Module
data : WA_CPARAM TYPE SSFCTRLOP,
WA_OUTPUT TYPE SSFCOMPOP.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = LF_FORMNAME
IMPORTING
FM_NAME = LF_FM_NAME.
WA_CPARAM-PREVIEW = 'X'.
WA_CPARAM-NO_DIALOG = 'X'.
WA_CPARAM-DEVICE = 'PRINTER'.
WA_OUTPUT-TDNOPRINT = 'X'. "No printing from print preview
WA_OUTPUT-TDDEST = 'LOCA'. "or 'LP01'. "Spool: Output device
CALL FUNCTION LF_FM_NAME
EXPORTING
CONTROL_PARAMETERS = WA_CPARAM
OUTPUT_OPTIONS = WA_OUTPUT
USER_SETTINGS = SPACE. -
Dear friends,
I wants to print my production order. How to set my printer as SAP default printer (in which t.code)
Please guide me
Thanks
Senthilhi senthil,
u can go to trx <b>SU3</b> and for the user in the Defaults TAB Spool Control->Output Device u can give the Printer name.
<b>Defualt printer assigned to the user will be stored in the table field USR01-SPLD</b>
Hope this helps
Cheers
Alfred -
Set Default Printer based on user setting using Powershell script
Hi
I would like to create a script that runs on user log off and captures the default printer (set manually by the user) and then another script to reapply the settings (saved upon log off) when the user logs back in.
This is because local printers are set as default printer (PDF Creator Programs) when we all use Network Printers so this means a user has to set default printer to the network printer all the time.
I have found this script to start with:
$Printer = Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select name | out-file C:\temp\Printer.txt
But the out file looks like this:
name
\\PrinterserverName\Accounts01
Which I dont see how it can be used on another script plus there are spaces after\Account01
Any Ideas please?
M
MaelitoHi Maelito,
According to your description, you want to export the default printer name to text file, then read this printer name from text file and set the default printer via Powershell:
#save printer name to text file
Get-WmiObject -namespace root\cimv2 -Query “select * from Win32_Printer Where Default = TRUE” -Impersonation 3 | select -ExpandProperty name | out-file C:\temp\Printer.txt
# read printer name from text file and set default printer
$name=get-content C:\temp\Printer.txt
(Get-WmiObject -Class Win32_Printer -Filter "Name='$name'").SetDefaultPrinter()
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
How to change the printer name in the User profile in the run time.
Hi
I am in need to change the printer name in the run time.
Do any one hav idea about this?
Thanks
KarthikThe user default settings can be changed using funtion module SUSR_USER_DEFAULTS_PUT.
Import parameter USER_DEFAULTS-SPLD will hold the default printer name. -
Mapping default printer based on AD attribute
Hi all !
Sorry for my english, i'll try to be clear... :)
I need to run a VBscript on TSE 2008 R2 servers to set computer's
default printer (not user). For this, I need to use the ClientName var.
The default printer name is written in the computer's description attribute in Active Directory.
I'm a beginner in VBscripting. I have parts of scripts working, but not everything.
Here is my script (my comments are written with ''''''''''''''''''''''''''''''''''''''''''''):
'find clientname
strComputer = "."
Const ForAppending = 8
Set oNetwork = wscript.CreateObject("wscript.network") 'Create network object
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
strUserName = oNetwork.userName
strComputerName = oNetwork.computerName
strClientName = objShell.ExpandEnvironmentStrings("%clientname%")
ExecuteSearch = SearchDistinguishedName(strClientName)
Public Function SearchDistinguishedName(ByVal vSAN)
Const ADS_SCOPE_SUBTREE = 2
Dim oRootDSE, oConnection, oCommand, oRecordSet
Set oRootDSE = GetObject("LDAP://rootDSE")
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = oConnection
ldstring = "'LDAP://" & oRootDSE.get("defaultNamingContext") & "'"
objCommand.CommandText = "Select Name, distinguishedName from "& ldstring & " where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
If lcase(objRecordSet.Fields("Name").Value) = lcase(vSan) Then
Wscript.Echo "Client Name: " & objRecordSet.Fields("Name").Value & vbCrLf _
& "Location: " & objRecordSet.Fields("distinguishedName").Value
'Wscript.Quit
End If
objRecordSet.MoveNext
Loop
End Function
' find canonical name
On Error Resume Next
ADSRoot = "DC=domain,DC=fr"
Const ADS_SCOPE_SUBTREE = 2
Set objConnection2 = CreateObject("ADODB.Connection")
Set objCommand2 = CreateObject("ADODB.Command")
objConnection2.Provider = "ADsDSOObject"
objConnection2.Open "Active Directory Provider"
Set objCommand2.ActiveConnection = objConnection2
objCommand2.Properties("Page Size") = 1000
objCommand2.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand2.CommandText = _
"SELECT * FROM 'LDAP://" & ADSRoot & "' WHERE objectCategory='user' OR objectCategory='computer'"
''''''''''''''''''''''''''''''''''''Here, I use a input box to enter the clientname, cause I don't know how to re-use the clientname found in the lasts vars.
srchTrm = LCase(InputBox("Please enter your search term.", "Active Directory Search"))
WScript.Echo srchTrm
i = 0
If Len(srchTrm) < 4 or Instr(srchTrm, "=") Then
WScript.Echo "Please enter a search term in excess of 3 characters. Don't use ""="""
WScript.Quit
End If
Set objRecordSet2 = objCommand2.Execute
objRecordSet2.MoveFirst
Do Until objRecordSet2.EOF
strADPath = LCase(objRecordSet2.Fields("adsPath").Value)
If InStr(strADPath, srchTrm) Then
Set objUser = GetObject(objRecordSet2.Fields("adsPath").Value)
Select Case objUser.Class
Case "user"
strMsg = "Type: Person" & VbCrLf
strMsg = strMsg & "Name: " & objUser.DisplayName & VbCrLf
strMsg = strMsg & "Email: " & objUser.mail & VbCrLf
strMsg = strMsg & "Telephone: " & objUser.telephoneNumber & VbCrLf
strMsg = strMsg & "Department: " & objUser.department & VbCrLf
strMsg = strMsg & "Title: " & objUser.title & VbCrLf
Case "computer"
strMsg = "Type: Computer" & VbCrLf
strMsg = strMsg & "Name: " & objUser.Get("name") & VbCrLf
strMsg = strMsg & "OS: " & objUser.operatingSystem & VbCrLf
Case Else
strMsg = "Unidentified" & VbCrLf
End Select
'strMsg = strMsg & "LDAP: " & objUser.adsPath & VbCrLf
objUser.GetInfoEx Array("canonicalName"), 0
strMsg = strMsg & "AD Path: " & objUser.canonicalName & VbCrLf
objUser.GetInfoEx Array("description"), 0
strMsg = strMsg & "Imprimante: " & objUser.description
WScript.Echo strMsg & VbCrLf
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Here I want to use the "objuser.description" to set default printer
Dim WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.SetDefaultPrinter "\\SRV-PRINT.domain.fr\" & objUser.description
i = i + 1
End If
objRecordSet2.MoveNext
Loop
If Not i > 0 Then
WScript.Echo "No results found."
End If
I think there's a most simple way to do this, but for the moment, I Don't know how to do.
Any help would be grateful.Hello.
We need to do this because each computer in the office as a network printer (or nearly each computer). I can't do a Group Policy for each computer in my domain. We cannot work with users accounts, only computers .
My problem is that if the user1 is connected on Comp1, he must have the printer near computer 1 as default printer.
If user1 is connected on computer 2, at the other side of the office, he must have the printer near computer 2. So I cannot imagine a group policy to do this :).
We had the idea to use the descprition attribute in Active Directory to indicate the default printer to map.
We must now make a script to get clientname on the TSE session, look for the computer account in Active Directory, read its description's attibute and map the default printer.
For example, my computer is COMP01. I use a TSE environment on SRVTSE01.
The script need to determine which computer (COMP01) is connected to the SRVTSE01 server (clientname var), search Active Directory computer account of COMP01, read the account's description attribute (for example PRINT01) and set \\SRV-PRINT\PRINT01 as the
default printer on COMP01.
Hope it's better with this example... -
How to Get Default Printer from ITS
Hi all,
I want to get the default printer name when i run application thru ITS ..
I have function module RSPO_FRONTEND_PRINTERS_FOR_DEV which shows the default printer available in the system but it is in SAPGUI and which dont work for ITS applications.
Does any body knows the function which brings Default printer in ITS . I appreciate your answers . I Appreciate your responses.
Thanks
Pradeep ReddyWith PrintGetPrinters(), I can get all printer in the list. If it is a bug, where to get the patch for 11.5?
My pb build is 11.5.1 4608.
Also, another alternative solution to get default printer with pb 11.5.1?
Another is: is Pb 11 and Pb 12 can be installed on windows XP side by side? -
Lf_fm_name error if default printer space
hı all
l want send smartform like pdf with mail but if default printer name space send_error or INTERNAL_ERROR in lf_fm_name function and ı dont write default printer . how can ı solved no write default printer name . you can see my code below .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSEFER_DETAY'
VARIANT = ' '"
DIRECT_CALL = ' '"
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*W_CTRLOP-no_open = 'X'.
**W_CTRLOP-no_close = 'X'.
W_CTRLOP-device = 'LP01'.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION lf_fm_name
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
gt_1003 = zsd_st09_01
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
TABLES
GT_1002 = GT_102
GT_1001 = gt_1001
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.hı madruha
W_CTRLOP-device = 'LP01'.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
*W_COMPOP-tdprinter = 'LP01'.
W_COMPOP-tdnewid = 'X'.
*W_COMPOP-TDNOARCH = 'X'.
*W_COMPOP-tddest = 'LP01'.
comm_val-adsmtp-smtp_addr = ismtp-smtp .
call function 'CONVERT_COMM_TYPE_DATA'
exporting
pi_comm_type = 'INT'
pi_comm_values = comm_val
importing
pe_device = w_ctrlop-device
pe_mail_recipient = mail_recipient.
CALL FUNCTION lf_fm_name
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
*OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
*mail_recipient = mail_recipient
gt_1003 = zsd_st09_01
yukleyen = yukle
sofor1 = sofor1
not1 = not1
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
TABLES
GT_1002 = GT_102
GT_1001 = gt_1001
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
okey applaying your solving but error sy-subrc 3 .
regard sinan . -
Printer name under Win NT/2000
Hi,
Does anyone have a VI or an idea how to retrieve the "Default printer
name" under Windows NT/2000? I am using LabVIEW 6.02.
Thanks,
Patrick Pol
Vitatron, the netherlandsPatrick,
I can see where you might want this info, but I know all the Print Report' VIs default to the default printer; however, if you weren't sure which printer was presently set as the default, then it would matter when you print - such as a color printer vs. B/W.
Here are 2 links to some default printer VIs which may help, if not, just use them as info.
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&E091308B77D6A8C88625683A000AD4BA&cat=FD6839395C5E51CF862567AC005866A9
http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&C7659492335F6AA08625695000650A7A&cat=FD6839395C5E51CF862567AC005866A9
Good Luck, Doug -
Change printer name for invoice
How can we change the Printer Name in SAP for Invoicing ?
Regards,
Aisha Ishrat.
ICI Pakistan.Hi,
In VF02 go to output determination.Here select the output type and select communication medium.Here you can set the Printer name.
But the default printer name can be set in user's own data
Reward points if useful
Regards,
Amrish Purohit -
Hi Oracle Masters,
Is there any way to get the default printer name at runtime, so that to specify it in DESNAME ??
As i want to assign different printer to specific module in my application.
Thank YouSo, you're using Webforms. Just to clear something out, which default printer name do you mean? The Server default printer or the client?
You're sure aware that the Reports Server is running on the server, and therefore you must mean the default printer of the server. Right? Since the default printer almost never change, I would create a key in $ORACLE_HOME/reports/conf/cgicmd.dat and use this when printing.
//Martin -
Get default printer share name
Can someone give a code snippet of how to get the default printer share name?
I'm able to get the printer name with the following but can't get the share name.
private void listClientPrinters(PrintService[] pServers) {
for (int i = 0; i < pServers.length; i++) {
javax.print.PrintService ps = pServers;
write_message("Client Printer "+i+": "+ps.getName());
}Thanks,hi,
Please refer the code elow..u should be able to crack this roblem..
data: l_usr01 like usr01.
CALL FUNCTION 'GET_PRINT_PARAM'
EXPORTING
I_BNAME = sy-uname
IMPORTING
E_USR01 = l_usr01.
output_options-TDARMOD = '1'.
output_options-TDDEST = l_usr01-spld.
output_options-TDRECEIVER = sy-uname.
output_options-TDCOPIES = '1'.
output_options-TDIMMED ='X'.
output_options-TDDELETE = 'X'.
output_options-TDLIFETIME = 0.
output_options-tdnoprev = 'X'.
output_options-tdnoprint = space.
output_options-tddelete = 'X'.
Please, assign points, if u have found it useful..
Thanks,
Nivin -
when I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?
Make sure that '''''Print to File''''' isn't selected in the native print dialog box ''(see screenshot below)'' middle-right, and make sure your Printer is selected at the top of that dialog box.
''I'm a little confused why an email attachment would need to go directly to the printer, but that's what you asked about.'' -
Here i want ask about how the printer name will get as default while taking print out.
I have maintained the condition record for Output and in which i have given printer name in communication , but still not able to get as deafult while taking printout.
Here my output type is against outbound delivery. when i am trying take print for outbound delivery system asks the printer name but i have already made a condition record for it.Hi,
Default Printers are sst for Deliveries in the " Define Print Parameters for shipping" in the output control for Deliveries.
Transaction VP01 for SHIPPING
Further set the print parameter at "Shipping point "in the output types.
And ofcourse maintain the required printer in the conditionnrercord for the access sequence specified.
You need to check the above points for the default printer.
Regards,
Maybe you are looking for
-
Htmldb server is not running anymore
Hi, Since a few days the htmldb server is not launched when I start my XE database. What are the options in this situations except reinstalling it ? Thanks.
-
Global Warranty Valid In India Or Not???
I had bought my iPhone 5s from US around 3-4 months ago n there is some the problem in charging slot .Will my phone covers warranty in India or should i wait as i am going back in next 2-3 months???
-
Import Function Problem.
I made a new ICT with a name of "DrawSquare" and imported the code my teacher gave me. * DrawSquare This class will create a piece of paper and a pencil, * place the pencil on the paper and then draw a square 100 units on * each side. * @author G. Pe
-
MSconfig boot is blank, but still boots. Need to remove a boot menu entry.
Hello, I have three boot menu entries that appear when I restart my pc. The last one I would like to remove, as it isn't valid anymore. When I go into msconfig, boot (tab), there isn't any entries in it. I tried recreating another administrator pr
-
Hi Gurus, In my dashboard I have a tab which is using dates Dates are from B3 to B53 and they are further referenced in other formulas as well Dates are in ascending order. Now my users wants to see dates in Descending order. Flipping the data will n