setPrintRange

I cant figure out how this should work.
if i want to print page 3.5. and 7 how do i do?
Or is it not possible, your java doc is a little bit unclear on this point.
How can i set the page numbers when the input value is int?

setPrintRange

public void setPrintRange(int value)
Sets the page numbers that the user has specified to be printed.
Parameters:
value - PdfPrintRange element
See Also:
PdfPrintRange

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

Selection
The selected pages are printed.
How can i set selected pages programatically, my printing service is running without GUI

/Mattias
Hi,

Thanks for sharing the details.

Currently Aspose.Pdf for Java offers the feature to specify the range of pages which you need to print but I am afraid currently Aspose.Pdf for Java do not offer the feature to set page number information for selected pages to be printed. However for the sake of correction, I have logged an investigation ticket as PDFJAVA-36224 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

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