Setting printer resolution programmatically

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

cmarsura
User
Posts: 91
Joined: Fri Jun 15, 2007 9:57 am
Location: Italy

Setting printer resolution programmatically

Post by cmarsura »

Hi, how can I set programmatically the printer resolution ?
In the PDF-XChange Driver API manual I cannot find any reference to this property, but the property appears in the printer dialog.
I tried

Code: Select all

PDFPrinter.Option("Paper.Resolution") = 600
or

Code: Select all

PDFPrinter.Option("Paper.Dpi") = 600
, but I got an error.

Is this an unimplemented property?

Thanks

Carlo Marsura
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Setting printer resolution programmatically

Post by Tracker Supp-Stefan »

Hello cmarsura,

I believe that you will need to set the DPI through the Devmode dmPrintQuality:
http://msdn.microsoft.com/en-us/library ... s.85).aspx

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

Re: Setting printer resolution programmatically

Post by Ivan - Tracker Software »

You can also set dpi using

Code: Select all

PDFPrinter.Option("DevMode.DPI") = 600
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.
cmarsura
User
Posts: 91
Joined: Fri Jun 15, 2007 9:57 am
Location: Italy

Re: Setting printer resolution programmatically

Post by cmarsura »

I tried to set the "DevMode.DPI" but to me seems to be supported but ignored.
I discovered also the "DevMode.Orientation" property but also this is ignored. Properties like "Paper.PageScale" or "General.Specification" are correctly supported instead.
I am using the version 4.0.195 of your printer.

See my included vbs with results, where I test the original "PDF-XChange 4.0" (with its defaults) vs. the the temporary printer created.

Can you verify this?

Carlo
You do not have the required permissions to view the files attached to this post.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3555
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: Setting printer resolution programmatically

Post by Ivan - Tracker Software »

When you are making changes to the DEVMODE via the PDFPrinter object, you have to call

Code: Select all

PDFPrinter.ApplyOptions(0)
The Parameter of this function is reserved for now and must be 0 (zero).

Regarding these lines in your code:

Code: Select all

'This property is supportet but appears to not be honorated
PDFPrinter.Option("DevMode.Orientation") = -1
Orientation can have either of these values : DMORIENTATION_PORTRAIT (value is 1) and DMORIENTATION_LANDSCAPE (2).

That should resolve your issues.
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.
cmarsura
User
Posts: 91
Joined: Fri Jun 15, 2007 9:57 am
Location: Italy

Re: Setting printer resolution programmatically

Post by cmarsura »

Applied your suggestions - now everything works well as expected.

Thank you very much for the promptly response, your support is good as ever.

PS: if you can, update the pdf manual with these two new properties, so all users can take advantage of this.

Carlo Marsura
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Setting printer resolution programmatically

Post by Tracker Supp-Stefan »

Glad to hear that everything is working now Carlo,

And I will pass this topic to the guys responsible for the manuals, so that this information gets included there.

Cheers,
Stefan
cmarsura
User
Posts: 91
Joined: Fri Jun 15, 2007 9:57 am
Location: Italy

Re: Setting printer resolution programmatically

Post by cmarsura »

Hi Stefan,
DevMode properties has not yet documented in the printer manuals.

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

Re: Setting printer resolution programmatically

Post by Tracker Supp-Stefan »

Hello Carlo,

Yes they are not -as they are documented here:
http://msdn.microsoft.com/en-us/library ... s.85).aspx

Best,
Stefan
cmarsura
User
Posts: 91
Joined: Fri Jun 15, 2007 9:57 am
Location: Italy

Re: Setting printer resolution programmatically

Post by cmarsura »

I am not referring to the DevMode documented in MSDN but instead to the object accessible via PDFPrinter.Option(), as suggested by Ivan in this thread here https://forum.pdf-xchange.com/ ... 887#p49552.
However, documentation does not clearly states that you can set the DevMode properties through a syntax like:

Code: Select all

PDFPrinter.Option("DevMode.DPI") = 600
.
Best.
Carlo.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Setting printer resolution programmatically

Post by Tracker Supp-Stefan »

Hi Carlo,

Sorry - seems I got the situation wrong. I will once again pass this thread for reviewing by the people working with the manuals and we will see to get this corrected.

Best,
Stefan