landscape\portrait issues with printing

Trying to print out of Servoy Client 3.5. Using the method below, I combine 5 forms in to a PDF document. User can choose to save or print.

My first two forms should print portrait, and the next three landscape. DefaultPageFormat for each form is set as such.

The first landscape page it encounters (page3) always prints as portrait, the the rest of the landscape pages print correctly (page 4 and 5). This is consistent regardless of which page I place first in the order. The first one always prints as portrait, and the rest are fine. Is there a way, other than setting the DefaultPageFormat property to force it to print as landscape?

//Show a save open dialog and retrieve the file
var file = plugins.file.showFileSaveDialog(".pdf");

//to print multiple forms to one pdf document (on file system).
var success = plugins.pdf_output.startMetaPrintJob(file)
if (success)
{
forms.page1.controller.print(true,false,plugins.pdf_output.getPDFPrinter());  //portrait
forms.page2.controller.print(true,false,plugins.pdf_output.getPDFPrinter()); //portrait
forms.page3.controller.print(true,false,plugins.pdf_output.getPDFPrinter()); //landscape
forms.page4.controller.print(true,false,plugins.pdf_output.getPDFPrinter()); //landscape
forms.page5.controller.print(true,false,plugins.pdf_output.getPDFPrinter()); //landscape
}
plugins.pdf_output.endMetaPrintJob()

Forms are simple forms without tabpabels.

please create a case for this

We have the exact same issue in 3.5.

Johan, is there a case filed? or maybe already fixed in 5.x?

There is a workaround for this problem. :D

The following code should produce 1 pdf with different orientations.

	// start output
	plugins.pdf_output.startMetaPrintJob();

	// Print first PDF
	forms[vForm1].controller.loadRecords("YOUR RECORDS");
	// portrait
	forms[vForm1].controller.setPageFormat(210, 297, 5, 0, 0, 0, 1, 0);
	forms[vForm1].controller.print(false, false, plugins.pdf_output.getPDFPrinter());
	
	// Finish output & get as pdf stream
	var vFirstPDF = plugins.pdf_output.endMetaPrintJob();
	
	// start output 
	plugins.pdf_output.startMetaPrintJob();

	// Print 2nd PDF
	forms[vForm2].controller.loadRecords("YOUR RECORDS");
	// Landscape
	forms[vForm2].controller.setPageFormat(210, 297, 5, 0, 0, 0,0, 0);
	forms[vForm2].controller.print(false, false, plugins.pdf_output.getPDFPrinter());
	
	// Finish output & get as pdf stream
	var vSecondPDF = plugins.pdf_output.endMetaPrintJob();

	// Combine pdfs into stream
	var vPDFArray = new Array(vFirstPDF, vSecondPDF);
	vCombinedPDF = plugins.pdf_output.combinePDFDocuments(vPDFArray);

	// write stream to pdf & present it
	plugins.file.writeFile(plugins.file.convertToJSFile(vFilePath_FileName), vCombinedPDF);