Free Support Forum - aspose.com

Print PDF page by page

We’d like to use Aspose.Pdf to print multiple page PDF files, with one additional requirement: Our code should be notified once each page is printed. I checked the API, there doesn’t seem to be a way to do this directly, I’m guessing the only way is to duplicate the logic in PrintDocumentWithSettings: convert page to image, create PrintDocument/PrintPageEventHandler, I wonder if there’re code examples for doing this?

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf for .NET.

Please explain your requirement in further detail that what kind of output you are expecting so we can further analyze your requirement and get back to you soon.

If your requirement is to print the pages of a PDF document one by one, you may use System.Drawing.Printing.PrinterSettings.PrintRange to setup the range of pages you want to print (set single page each time) and call PrintDocumentWithSettings method in a loop to print pages one by one. Please share the details regarding your requirement.

Sorry for the inconvenience,

We'd like to know when each page of the pdf file is printed, so that we can notify our user how many pages are printed successfully. For example, if a pdf file has 6 pages, and the printer went offline after printing 5 pages, we'd like to tell user that 5 out of 6 pages are printed successfully.


The idea of using PrintRange to do this seems doable, we'll look into this, thanks!

Hi,


Thanks for sharing the details and sorry for replying you late.

Currently PdfViewer loads the PDF file and send its for printing. I am afraid it does not support the feature to get acknowledgement about pages being printed. However as a workaround, you may consider splitting the PDF file into individual page documents and try printing the single page documents. Please visit the following link for further information on Split PDF pages

In case it does not satisfy your requirement, please feel free to contact.