PDF document getting scrambled when printing

Hi

We currently get PDF documents supplied by third parties which we push on to a printer selected by the user end user. This is currently working fine in all cases except for documents from this one party (sample attached).

Document
We are using Aspose.PDf.Kit version 4.9.0.0 and the code is:

PdfViewer viewer = new PdfViewer();
viewer.OpenPdfFile(pdfData );
viewer.PrintPageDialog = false;
viewer.AutoResize  = false;
viewer.AutoRotate  = false;
PageSettings pageSettings = printerSettings.DefaultPageSettings;
pageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0 );
viewer.PrintDocumentWithSettings(pageSettings, printerSettings );
viewer.ClosePdfFile();

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 that is last resort due to other system constraints

Simon Meakin
Product Team Lead

Relay Software Ltd

Hi Andrew,

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 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 = new Pdf();
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.

The issues you have found earlier (filed as PDFNET-35440) have been fixed in Aspose.PDF for .NET 25.8.