Page/sheet size setting in PDF-XChange Drivers API version 8

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
jochen_t
User
Posts: 3
Joined: Tue Aug 06, 2019 9:06 am

Page/sheet size setting in PDF-XChange Drivers API version 8

Post by jochen_t »

I have been using PDF-XChange Drivers API version 5 in the past. As I am updating a software package for the latest OS/.NET versions, I am evaluating PDF-XChange Drivers API version 8.

During evaluation I stumbled upon an issue setting the page/sheet size. The way I did it in version 5 (setting "Dev.<Option>" options for the printer doesn't seem to work in version 8 anymore. So I checked the documentation. If I understand the documentation correctly, it should be possible to define a custom page size using "Paper.SheetSizeIndex", "Paper.SheetWidth" and "Paper.SheetHeight", and built the following code (excerpt):

Code: Select all

printer.set_Option("Paper.LayoutType", "Normal");
printer.set_Option("Paper.SheetSizeIndex", -2);

if (pageLayout == PageLayout.PORTRAIT) {
	//width = (int)Math.Round((double)(width / 10), 0);
	//height = (int)Math.Round((double)(height / 10), 0);

	logger.Debug(String.Format("Page [layout: {0}, width: {1}, height: {2}]", pageLayout, width, height));

	printer.set_Option("Paper.SheetWidth", width);
	printer.set_Option("Paper.SheetHeight", height);

} else {
	//width = (int)Math.Round((double)(height / 10), 0);
	//height = (int)Math.Round((double)(width / 10), 0);

	logger.Debug(String.Format("Page [layout: {0}, width: {1}, height: {2}]", pageLayout, width, height));

	printer.set_Option("Paper.SheetWidth", width);
	printer.set_Option("Paper.SheetHeight", height);
}

printer.ApplyOptions(0);
But regardless of how I set <width> and <height>, the PDF always has a page size of A4.

I checked the API documentation, the examples and developer forums but could not find any hint.

What am I doing wrong?
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Page/sheet size setting in PDF-XChange Drivers API version 8

Post by Tracker Supp-Stefan »

Hello Jochen,

Your sample seems to specify values of 10 - which is less than the allowed range of 13-50800 (value in tenths of millimeters).

So please try to specify e.g. 2000 x 2000 - and see if you will get a 20 x 20 cm page as a result.

Regards,
Stefan
jochen_t
User
Posts: 3
Joined: Tue Aug 06, 2019 9:06 am

Re: Page/sheet size setting in PDF-XChange Drivers API version 8

Post by jochen_t »

Stefan,

thanks for your quick response.

In my sample there is no code that sets width and height. The lines of code that set these values are commented out.

In fact, the value for width is 8400, that for height is 11880 at the time the code snippet is activated.

Any more ideas?

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

Re: Page/sheet size setting in PDF-XChange Drivers API version 8

Post by Tracker Supp-Stefan »

Hello Jochen,

Can we have a small compilable sample which illustrates the issue?
Please make sure to remove any license information from it first!

Regards,
Stefan
Post Reply