Printer Names

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Printer Names

Post by ashley3289 »

I am calling the following line of code from a button in my application and it creates a printer with the name "PrinterA" as expected.
PDFPrinter = PDFPFactory.Printer("", "PrinterA", "<REG CODE>", "<DEV CODE>")

With the application still running if I click the button again to execute the same line it creates a printer with the name "PrinterA(1)". This is what the documentation says it will do. However I have a problem. If my application crashes I will still have "PrinterA" listed as a printer and so when the application starts it will create "PrinterA(1)". Having 2 printers like this will confuse my end user and only one of the printers will be connected to the printer events.

1. How can I connect to an already created printer?

2. If I cannot connect to an already created printer then how can I deleted the printer with the name that I want to use? In this case I am assuming that the printer with the name that I want to use was created with the code mentioned above.


I am not sure but I just found this RemoveOrphanPrinters. Is this what I can use and if so can you provide me with and example in VB.net.

It looks like the following code would both add then delete "PrinterA" but it only adds it.
I am using pxclib40.dll version 4.0.177.0 on a 64 bit windows 7 OS.

Dim PDFPFactory As New PXCComLib.CPXCControlEx
Dim WithEvents PDFPrinter As PXCComLib.CPXCPrinter

PDFPrinter = PDFPFactory.Printer("", "PrinterA", "<REG CODE>", "<DEV CODE>")
PDFPFactory.RemoveOrphanPrinters("", "PrinterA")



Thanks,
Ashley
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6844
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Printer Names

Post by Paul - Tracker Supp »

Hi ashley3289,

someone from the dev team will take a look at this soon,

sorry for the delay in answering.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Printer Names

Post by Ivan - Tracker Software »

This code

Code: Select all

Dim PDFPFactory As New PXCComLib.CPXCControlEx
Dim WithEvents PDFPrinter As PXCComLib.CPXCPrinter

PDFPrinter = PDFPFactory.Printer("", "PrinterA", "<REG CODE>", "<DEV CODE>")
PDFPFactory.RemoveOrphanPrinters("", "PrinterA")
will not delete printer, because it is locked (PDFPrinter object contains opened handle of the printer inside).
You need to release PDFPrinter before call RemoveOrphanPrinters.

Best,
Ivan
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

I am not sure what you mean by release the printer. Can you provide me with a code example? What I am trying to do is get rid of any orphaned printers when my application loads. Here is the scenerio that causes the problem.

1. When the application loads I create a printer called "PrinterA"
2. For some reason the application crashes
3. The User restarts application but this time it creates a printer called "PrinterA(1)"

Now I have 2 printers "PrinterA" and "PrinterA(1)". This will be very confusing to the end user and plus only the events of the last created printer will work. Here is what I need to happen.

1. User starts application
2. Check for any orphaned printers named "PrinterA"
3. If there are any orphaned printers remove them.
4. Create a printer named "PrinterA"

I hope this better explains what I am trying to accomplished.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Printer Names

Post by Ivan - Tracker Software »

Please try this code

Code: Select all

Dim PDFPFactory As New PXCComLib.CPXCControlEx
Dim WithEvents PDFPrinter As PXCComLib.CPXCPrinter

PDFPFactory.RemoveOrphanPrinters("", "PrinterA")
PDFPrinter = PDFPFactory.Printer("", "PrinterA", "<REG CODE>", "<DEV CODE>")
There orphaned printers are removed before create new printer.
I am not sure what you mean by release the printer.
I'm not so familiar with VB, but as I know, you need to set your PDFPrinter variable to Nil value to release printer's object.

Code: Select all

Set PDFPrinter = Nil
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

I haved tried various methods but I cannot get the function PDFPFactory.RemoveOrphanPrinters("", "PrinterA") to remove the printer. Can you verify that this works properly. I have quoted a post which is listed below that shows there may be a problem with this function call from the lastest build.

For my testing I have an application with 2 buttons. Button 1 executes PDFPrinter = PDFPFactory.Printer("", "PrinterA", "<REG CODE>", "<DEV CODE>"). Button 2 executes PDFPFactory.RemoveOrphanPrinters("", "PrinterA"). Here is the procedure that I use to recreate the issue. I am using pxclib40.dll version 4.0.177.0 on a 64 bit windows 7 OS.

1. Run the application.
2. Click button 1
3. Use task manager to kill the application
4. Ensure that "PrinterA" has been created
5. Run the application again
6. Click Button 2
7. "PrinterA" still remains

Thanks for your help.

drom296
User

Joined: Wed Jan 06, 2010 10:59 am
Posts: 5 Re: When application crashes - temporary printer remains
Thank you for the reply.

I'm running 4.0174 i believe, but I have fixed the problem. I ended up using the Windows API to delete the printer, specifically Winspool.deletePrinter. Thank you for the assistance though!
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Printer Names

Post by Ivan - Tracker Software »

Please send me you application (would be good if it will have no extra depends).
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

Attach is my project. Thank you for looking at it.
Attachments
AddDeletePrinterExample.zip
Sample project
(4.92 MiB) Downloaded 207 times
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

Where you able to reproduce the issue I am experiencing? When you get a chance can you please provide me with some information regarding if you can use the application that I provide to reproduce the issue.

Thanks,
Ashley
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printer Names

Post by Tracker Supp-Stefan »

Hello Ashley,

Asked Ivan to have another look at this topic - he will reply when he comes to work.

Regards,
Stefan
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printer Names

Post by Tracker Supp-Stefan »

Hello Again Ashley!

There was a problem in the printing driver that is now fixed and the fix will be available with the next build.

Also please modify your code and add PDFPrinter = Nothing:

Code: Select all

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PDFPrinter = Nothing
PDFPFactory.RemoveOrphanPrinters("", "PrinterA";)
End Sub

whithout "PDFPrinter = Nothing", there might be some problems as without it if you RemoveOrphanPrinters the printer will not be available.

Best,
Stefan
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

When will the next build occur?
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Printer Names

Post by John - Tracker Supp »

In around 7 days - thanks for your patience.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

That sounds great. Thank your for all of your help.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printer Names

Post by Tracker Supp-Stefan »

Our Pleasure Ashley
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

Just wanted to check to see if the new Printer drive API has been release. If so where can I download it? If it has not been release when do you expect to release it?

Thanks,
Ashley
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6844
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Printer Names

Post by Paul - Tracker Supp »

Hi Ashley,

it should be available in the week following Easter, less than a week now. Sorry - things got a little pushed back here.

again, your patience here is appreciated.

sincerely
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

Just checking to see if the Print Driver API is ready.

Thanks,
Ashley
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Printer Names

Post by Tracker Supp-Stefan »

Hello Ashley,

Unfortunately build 180 is not ready yet but we are almost there.
I just spoke with the dev team and they told me that it should be ready by the end of this week.

Best,
Stefan
ashley3289
User
Posts: 37
Joined: Wed Feb 10, 2010 10:58 pm

Re: Printer Names

Post by ashley3289 »

Is the printer driver ready?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Printer Names

Post by Ivan - Tracker Software »

Yes, please download it from our site.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Post Reply