We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting black background when printing pdf file using Aspose.pdf.kit.PdfViewer

Hi,

I am trying to print a pdf document using Aspose.pdf.kit.PdfViewer but i am getting black shaded page in the printed sheet. I have pasted below my snippet of code

printerJob = PrinterJob.getPrinterJob();

PageFormat pf = PrinterJob.getPrinterJob().defaultPage();

printerJob.setJobName(jobName);

// Create PDF Print Page

PdfViewer pdfviewer = new PdfViewer();

//pdfviewer.openPdfFile(new ByteArrayInputStream(pdfContent));

pdfviewer.openPdfFile("D:\\out123.pdf");

pdfviewer.enableScalePrint(false);

int startPage = 1;

int endPage = pdfviewer.getPdfFilePageCount();

pdfviewer.setPrintPageRange(startPage, endPage);

for (int page = startPage; page < endPage + 1; page++)

pdfviewer.setPageFormat(page, pf);

printerJob.setPageable(pdfviewer);

Paper paper = new Paper();

paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());

pf.setPaper(paper);

printerJob.print();

I have attached the sample pdf(out123.pdf) with this post. Printed pdf also i have attached(Sample.pdf).

We were trying to see the root cause but we didn't get anything. Please give me the solution for this.

Thanks.

Hi Mohanraj,


Thanks for using our products.

I have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as
PDFKITJAVA-31936. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

Hi Team,


Thanks for your reply.

We are waiting for your update on this.

Thanks in Advance.

Hi Mohanraj,

I would like to share with you that you’ll be notified via this forum thread as soon as the release containing the fix for this issue is published. Moreover, as this issue was logged recently, it is going to take some time before it is resolved.

If you find any further questions, please do let us know.
Regards,