Printer Names
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Printer Names
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
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
- Paul - Tracker Supp
- Site Admin
- Posts: 6844
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: Printer Names
Hi ashley3289,
someone from the dev team will take a look at this soon,
sorry for the delay in answering.
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
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: Printer Names
This code
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
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")
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.
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.
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
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.
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.
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: Printer Names
Please try this code
There orphaned printers are removed before create new printer.
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>")
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.I am not sure what you mean by release the printer.
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.
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.
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
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!
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!
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: Printer Names
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.
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.
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
Attach is my project. Thank you for looking at it.
- Attachments
-
- AddDeletePrinterExample.zip
- Sample project
- (4.92 MiB) Downloaded 207 times
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
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
Thanks,
Ashley
- Tracker Supp-Stefan
- Site Admin
- Posts: 17824
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Printer Names
Hello Ashley,
Asked Ivan to have another look at this topic - he will reply when he comes to work.
Regards,
Stefan
Asked Ivan to have another look at this topic - he will reply when he comes to work.
Regards,
Stefan
- Tracker Supp-Stefan
- Site Admin
- Posts: 17824
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Printer Names
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:
whithout "PDFPrinter = Nothing", there might be some problems as without it if you RemoveOrphanPrinters the printer will not be available.
Best,
Stefan
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
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
When will the next build occur?
- John - Tracker Supp
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
- Contact:
Re: Printer Names
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
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
That sounds great. Thank your for all of your help.
- Tracker Supp-Stefan
- Site Admin
- Posts: 17824
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Printer Names
Our Pleasure Ashley
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
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
Thanks,
Ashley
- Paul - Tracker Supp
- Site Admin
- Posts: 6844
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: Printer Names
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
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
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
Just checking to see if the Print Driver API is ready.
Thanks,
Ashley
Thanks,
Ashley
- Tracker Supp-Stefan
- Site Admin
- Posts: 17824
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Printer Names
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
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
-
- User
- Posts: 37
- Joined: Wed Feb 10, 2010 10:58 pm
Re: Printer Names
Is the printer driver ready?
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: Printer Names
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.
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.