Invalid PDF Page Size after converting Image to PDF

Hello,

if we try to convert the attached image to PDF and open the PDF in Acrobat, the attached Error will be shown.

Is this a bug or is there a property which will avoid this behavior?

Image: AV Seite 2.jpeg (459,1 KB)
Output PDF:
ConvertedFromEMail_d2e161f0-0152-4388-9687-8620c032c72e.pdf (859,4 KB)

ErrorMessage:
2024_04_18_11_13_59_Adobe_Acrobat.png (7,0 KB)

Our Code:
using (var image = Image.Load(InputFile, new LoadOptions()))
{
using (var exportOptions = new PdfOptions())
{
exportOptions.PdfDocumentInfo = new PdfDocumentInfo();
exportOptions.UseOriginalImageResolution = true;
image.Save(outputFile, exportOptions);
}
}

Kind Regatrds,
Andy

@AStelzner Hello! Please note that the resolution of the original image is too high for exporting as a PDF file. To resolve this issue, kindly remove the line
exportOptions.UseOriginalImageResolution = true;
This should allow the exported PDF document to open successfully using Adobe Acrobat.

If you have any further issues or queries, please don’t hesitate to reach out.

1 Like

One last question:

the ((RasterImage)image).HorizontalResolution is 1 in this case.

What is the minimum oder maximum to set the exportOptions.UseOriginalImageResolution
to true? What makes sense? :slight_smile:

Because in the most cases we need to set UseOriginalImageResolution to true!

Kind Regards,
ANdy

If i look to the properties of the image file the DPI is 96 (verticalö and horizontal).
1.) Why ist it to high?
2.) Why return the Aspose Properties 1?

:slight_smile:

Kind Regards,
ANdy

@AStelzner We are looking into your issue and aim to provide a comprehensive response as soon as possible. Thank you for your patience.