Hi Mattias,
Thanks for contacting support.
In order to accomplish this requirement, please try using following code snippet.
[Java]
// Create PdfViewer object
com.aspose.pdf.facades.PdfViewer viewer = new com.aspose.pdf.facades.PdfViewer();
// Open input PDF file
viewer.bindPdf(path + "4pages.pdf");
viewer.setAutoResize(true); // Print the file with adjusted size
viewer.setAutoRotate(true); // Print the file with adjusted rotation
com.aspose.pdf.printing.PdfPrinterSettings printerSettings = new com.aspose.pdf.printing.PdfPrinterSettings();
printerSettings.setFromPage(1);
printerSettings.setToPage(2);
printerSettings.setPrintRange(com.aspose.pdf.printing.PdfPrintRange.Selection);// or PdfPrintRange.SomePages
com.aspose.pdf.printing.PrintPageSettings pageSettings = new com.aspose.pdf.printing.PrintPageSettings();
// Print PDF document
viewer.printDocumentWithSettings(pageSettings, printerSettings);
// Close the Pdf file.
viewer.closePdfFile();
Thanks for a fast and good answer,
Ok that explains setPrintRange function.
I belive PdfPrintRange.AllPages is default.
The setFromPage and setToPage is clear. So if i want to print pages between 1-3 or 2-4 i use PdfPrintRange.Some Pages
But if i want to print pages 1, 3, 5 i should use PdfPrintRange.Selection
According to your doc it should be possible to select pages
How can i set selected pages programatically, my printing service is running without GUI
/Mattias
The issues you have found earlier (filed as PDFJAVA-36224) have been fixed in Aspose.Pdf for Java 16.11.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan