Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't always find the printer with PrintGetPrinters()

Status
Not open for further replies.

Henrik74

Programmer
Mar 5, 2018
1
0
0
SE
Hi,

We have a service made in PowerBuilder 12 that we use to create PDF document's
The problem is that the PrintGetPrinters() is not always finding the installed printer that is a virtual FILE: printer 'HP Universal Printing PS (v5.7.0)
The printer is named 'PostScript to PDF'.
We run this service on a 64-bit Windows Server 2012 R2.

I don't know what to check what might go wrong when it's not finding the printer?
I have made sure that the Printer Spooler Service is running.
Anyone have any clue what else to check what might go wrong?
Below is the code we are using.

Kind Regards,
Henrik


// Check if the printer exist/is configured
printers = PrintGetPrinters()
found = false
do while (Len(printers) > 0 and found = false)
ix = Pos(printers, "~n")
if (ix > 0) then
printer = Left(printers, ix) // Next printer
else
printer = printers // The remainder/last printer
ix = Len(printers)
end if
printer = Left(printer, Pos(printer, "~t") - 1) // Pick out the printer name
printers = Mid(printers, ix + 1) // Remove the picked out printer from the list
if (printer = printer_to_use) then
found = true
end if
loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top