We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Get correct size of image from ExportAsImage

Hi. Trying to get image of specified size

private Bitmap Convert(SizeF size)
    //Load the input PDF file
    var lDoc = new PdfLoadedDocument("exportAsImageTest.pdf");
var dpi = 300;
    //Export first page as image
    Bitmap result;
    if (size.IsEmpty)
        result = lDoc.ExportAsImage(0, dpi, dpi);
        result = lDoc.ExportAsImage(0, size, dpi, dpi, true);
    return result;

If I don't specify size, I get  {Width = 2480 Height = 3507}

If I specify size in pixels, Width=1000, Height=1000, I get  {Width = 2209 Height = 3125}

If I specify same size in points, Width=240, Height=240, I get  {Width = 530 Height = 750}

How to correctly specify size to get image of desired siz

Attachment: exportAsImageTest_83f7441f.zip

4 Replies

IJ Irfana Jaffer Sadhik Syncfusion Team January 18, 2023 03:30 PM UTC

We have checked the reported issue on our end. It is a PDF behavior. we can only able to export the pages of the PDF document as per the PDF Page size and not in any predefined size. However, Using the dpi overload we can able to achieve the image in different resolutions. So, we cannot proceed further with your requirement.

VI ViterAlex January 19, 2023 03:13 AM UTC

Thank you for the answer so method ExportAsImage is pretty useless and doesn't work as specified

WI will April 3, 2023 08:10 AM UTC

Binary data into pdf file

First, install database activities from the manage package.

Get the table from the database using database activity.

Use for each activity to loop the data table.

Get the binary data and convert to byte.

Use invoke code activity and pass the converted byte and file name as arguments.



SS Swetha Srikumar Syncfusion Team April 4, 2023 09:29 AM UTC

Thanks for the information.

Live Chat Icon For mobile
Up arrow icon