SetAsDefaultPrinter Issue

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
northgate information solutions
User
Posts: 8
Joined: Wed Oct 03, 2012 3:23 pm

SetAsDefaultPrinter Issue

Post by northgate information solutions »

Hi,

I am looking at an issue with our VB6 code, the code has worked previously with no issue.

The problem is we are trying to save a .doc file as a .pdf silently in a sub-routine, but it seems that the default printer is not being set up properly and the document just gets printed on the default printer.

The command to save this document to a .pdf is Shellexecute 0, "printto" , "c:\path\temp.pdf" , """" + printername + """" , vbnull, SW_MINIMIZE

If I stop the code before this line above and check my printers, my new printer is there but not set as the default printer, if I then set this manually then the .pdf file is saved to correct directory.

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

Re: SetAsDefaultPrinter Issue

Post by Tracker Supp-Stefan »

Hello northgate information solutions,

A possible solution would be to change the default printer to what you want, print to it and then restore the default to what it was before you "printed".

There are samples of such methods in e.g. the C# sample projects, and the same should be available in the VB6 ones as well.

Regards,
Stefan
northgate information solutions
User
Posts: 8
Joined: Wed Oct 03, 2012 3:23 pm

Re: SetAsDefaultPrinter Issue

Post by northgate information solutions »

I think you misunderstood me, I have 4 printers installed, my default printer is P1, I create a pseudo printer PDF5X and set up options for this printer and then I try and save my word document as a .PDF through the printer PDF5X. In my code I have already set the default printer using PDFPrinter.SetAsDefaultPrinter, but my default printer never changes to the PDF5X.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: SetAsDefaultPrinter Issue

Post by Tracker Supp-Stefan »

Thanks for the extra details northgate information solutions,

You also need to make sure that
PDFPrinter.ApplyOptions(0);
Is called after SetAsDefaultPrinter(), and before actually starting sending data for printing.

Regards,
Stefan
northgate information solutions
User
Posts: 8
Joined: Wed Oct 03, 2012 3:23 pm

Re: SetAsDefaultPrinter Issue

Post by northgate information solutions »

Hi Stefan,

the PDFPrinter.ApplyOptions(0) was set.
northgate information solutions
User
Posts: 8
Joined: Wed Oct 03, 2012 3:23 pm

Re: SetAsDefaultPrinter Issue

Post by northgate information solutions »

Hi Stefan,

long time no hear!!!

I have re-wrote the sub-routine to use MS word object!!!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: SetAsDefaultPrinter Issue

Post by Tracker Supp-Stefan »

Hello northgate information solutions,

I passed this to a colleague of mine last night, but have not yet received feedback from him.
Is your latest post meaning that you got things running as expected now?

Regards,
Stefan
northgate information solutions
User
Posts: 8
Joined: Wed Oct 03, 2012 3:23 pm

Re: SetAsDefaultPrinter Issue

Post by northgate information solutions »

Hi Stefan,

my latest post means that I had to write a workaround to bypass your potential bug.

I am now looking into using MS word plugin to achieve this and bypass using your library.

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

Re: SetAsDefaultPrinter Issue

Post by Tracker Supp-Stefan »

Hi northgate information solutions,

I am trying to get some further advise for your case from my colleagues!

Regards,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: SetAsDefaultPrinter Issue

Post by Ivan - Tracker Software »

Can you please let us know the OS you are using?
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.
northgate information solutions
User
Posts: 8
Joined: Wed Oct 03, 2012 3:23 pm

Re: SetAsDefaultPrinter Issue

Post by northgate information solutions »

Developed on XP with service pack 3
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: SetAsDefaultPrinter Issue

Post by Tracker Supp-Stefan »

Thanks northgate information solutions,

Passed that to Ivan, and he will follow up with you later.

Regards,
Stefan
Post Reply