Printing produces corrupt output

I am trying to print a PDF document using PdfViewer. Each line of text is being printed many times superimposed on itself but offset. So when trying to print "This is a test document" it comes out more like "ThisThis isThis is a This is a testThis is a test document".

Not all lines are corrupted exactly like this, some appear to be superimposed rather than just repeated.

Does anyone have any ideas what may cause this?

Hi Philip,

Thanks for your interest in our products.

Can you please share some details regarding sample source code and template documents you are using or create a sample application to show the issue. This will help us to figure out the exact issue and reply back to you soon.

We apologize for your inconvenience.

Thanks & Regards,

I have attached some sample Java code that demonstrates the problem. The class is in file PrintTest.txt (I wasn't allowed to upload a .java file). Also attached are a sample PDF document and the output that was produced from the code. This was generated by running the code using printer name "Microsoft XPS Document Writer". Note that the PDF document was itself generated by converting an existing MS Word document.

I am using Aspose.Words.jdk16.jar and aspose-pdf-kit-4.2.0.jar

Thanks

Sorry, I also meant to add that the first page is always being output in landscape mode, even though I have set the layout to portrait. Is there a solution to this also?

Thanks

Hi Philip,


Thanks for sharing the resource files.

I have tested the scenario and I am able to reproduce the text overlapping issue. For the sake of correction, I have logged this problem as PDFKITJAVA-33189 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 your inconvenience.

Besides this, when I have tried using the code snippet that you have shared, I am able to reproduce that first page output is in LandScape however when using the following code snippet, the output is always in Portrait.

[C#]

//sets the default print scale

  • false.<o:p></o:p>

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 );

//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();

Yes I agree. 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.

Do you have any news on the more serious problem of the corrupt output?

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.

I have been waiting for almost a year and a half for some news on this serious problem with your product. Do you have anything to add yet?

Hi Philip,


Thanks for your patience and sorry for the delayed response.

I am in coordination with development team to get the latest status regarding the resolution of this problem and will keep you posted on the status of correction.