philf27:
The second problem seems to be with the forced setting of the orientation using setOrientation() on PageFormat. If this isn't called the orientation is portrait throughout. If it is called to force portrait then the first page appears in landscape.
Hi Philip,
Thanks for sharing the details.
I have tested the scenario using Aspose.Pdf.Kit for Java 4.3.0 where I have explicitly set the page orientation as Portrait and as per my observations, the pages in resultant XPS are in Portrait mode. I am also getting the same result when I have commented out this code line. Can you please confirm which version of Aspose.Pdf.Kit for Java you are using ?
I have also attached the resultant XPS that I have generated using below specified code.
[Java]
// create PdfViewer object
com.aspose.pdf.kit.PdfViewer
pdfviewer = new com.aspose.pdf.kit.PdfViewer();
// open the source PDF file
pdfviewer.openPdfFile("D://pdftest//TestDoc.pdf");
//sets the default print scale
- false.
pdfviewer.enableScalePrint(false);
//gets a printjob
object.
PrinterJob printJob = PrinterJob.getPrinterJob();
//gets the default page.
PageFormat pf =
printJob.defaultPage();
// Set up the A4 paper size
Paper paper = new Paper();
paper.setSize( 595, 842 );
paper.setImageableArea( 43, 43,
509, 756 );
// set the Paper object for
this PageFormat.
pf.setPaper( paper );
// force to set the orientation
as Portrait
pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
//allows user to edit settings
and select printing
printJob.setPrintable(pdfviewer,
pf);
//creates the printDialog.
boolean printFile =
printJob.printDialog();
if (printFile)
{
printJob.print();
}
//close the Pdf file.
pdfviewer.closePdfFile();
philf27:
Do you have any news on the more serious problem of the corrupt output?
Our development team is working hard on resolving this problem and as soon as we have made significant progress towards its resolution, we would be more than happy to update you with the status of correction .Please be patient and spare us little time. We are sorry for your inconvenience.