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);
I checked the API documentation, the examples and developer forums but could not find any hint.
What am I doing wrong?