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

Free Support Forum - aspose.com

PDF document getting scrambled when printing

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

We currently get PDF documents supplied by third parties
which we push on to a printer selected by the user end user. <o:p></o:p>

This is currently working fine in all cases except for
documents from this one party (sample attached).<o:p></o:p>

We are using
Aspose.PDf.Kit version 4.9.0.04.9.0.0 and the code is:<o:p></o:p>



PdfViewer viewer = new PdfViewer();<o:p></o:p>

viewer.OpenPdfFile( pdfData
);<o:p></o:p>


viewer.PrintPageDialog = false;<o:p></o:p>

viewer.AutoResize = false;<o:p></o:p>

viewer.AutoRotate = false; <o:p></o:p>

PageSettings
pageSettings = printerSettings.DefaultPageSettings;<o:p></o:p>

pageSettings.Margins = new System.Drawing.Printing.Margins(
0, 0, 0, 0 ); <o:p></o:p>

viewer.PrintDocumentWithSettings(
pageSettings, printerSettings ); <o:p></o:p>

viewer.ClosePdfFile();<o:p></o:p>

I believe the issue is down to the PDF version they are using but is there a way to get the print to work

Updating to a new version of Aspose would be considered a
last resort due to other system constraints



Simon Meakin

Product Team Lead

Relay Software Ltd<o:p></o:p>

Hi Andrew,


Thanks
for using our products.<o:p></o:p>

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 PDFNEWNET-35440. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Thanks for the response, is there a work around that we could use?

Hi Andrew,


As a workaround, you may first consider converting the pages of PDF document to image format, place all individual images in PDF file, and then try printing the newly created PDF file.

Convert PDF pages to Image
Please visit the following link for instructions on Convert all PDF pages to JPEG Images

Convert images to PDF format
Please try using the following code snippet to convert images to PDF format. How to Convert an Image to PDF
[C#]

Pdf pdf = new Pdf();<o:p></o:p>

Section sec = pdf.Sections.Add();

for (int i = 1; i <= 4; i++)

{

Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();

img.ImageInfo.File = "c:/pdftest/Statement+Of+Fact_image"+i+".jpg";

img.ImageInfo.ImageFileType = ImageFileType.Jpeg;

sec.Paragraphs.Add(img);

}

pdf.Save(“c:/pdftest/ImageTOPDFCOnversion.pdf”);



In case of any further query, please feel free to contact.

Hi

Thanks for getting back to me.

I have tried your suggestion and it does work however it's simply to slow (over a minute for the four pages and I have a very powerful machine)

Our users would have bog standard machines so there is no way they could work with this especially generating large packs of documents.

Is there anything else we could try, thanks

Hi Andrew,


I am afraid currently I cannot share any other solution to resolve this problem. However I would recommend you to please be patient and spare us little time. We are sorry for this inconvenience.