Page 1 of 1

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

Posted: Tue Aug 06, 2019 10:04 am
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?

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

Posted: Tue Aug 06, 2019 10:47 am
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

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

Posted: Tue Aug 06, 2019 10:54 am
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

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

Posted: Tue Aug 06, 2019 11:04 am
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