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.
Unfortunately, activation email could not send to your email. Please try again.

render pdfpage to bitmap (=raster) with given resolution or image size ?

Thread ID:

Created:

Updated:

Platform:

Replies:

127625 Nov 29,2016 04:43 AM Dec 2,2016 04:55 AM WPF 3
loading
Tags: PDF
fff
Asked On November 29, 2016 04:43 AM

Hi SF & community,

I have a typical pdfpage added via pdfdoc.Pages.Add();
and then populated with syncfusion tools & functions

How can I render that page to bitmap with either a given resolution (ppi) or total image Width/Height size ?

Thanks,
F 

Gayathri Ramalingam [Syncfusion]
Replied On November 30, 2016 09:38 AM

Hi Fabrice, 
 
Thank you for using Syncfusion products. ExportAsImage can be achieved only through the PdfLoadedDocument.  
Method 1: 
The PdfDocument cannot be directly converted to bitmap. The PdfDocument need to be stored in stream and we need to convert the stream as PdfLoadedDocument. And then the pdf can be converted to bitmap. 
 
Please find the sample from the below link, 
 
 
Method 2: 
Please find the code snippet to convert the PDF page to Image using PdfLoadedDocument, 
PdfLoadedDocument doc = new PdfLoadedDocument(@"Barcode.pdf"); 
Bitmap image = doc.ExportAsImage(0, new SizeF(doc.Pages[0].Size.Width, doc.Pages[0].Size.Height), true); 
 
Please find the sample from the below link, 
 

With Regards, 
Gayathri R 


fff
Replied On December 1, 2016 03:36 AM

Hi,

Thanks for that fast & so detailed answer
I will use the methos #1 as I can not save the .pdf to disk in that case

BR & hope it will also help others,
Fabrice

Gayathri Ramalingam [Syncfusion]
Replied On December 2, 2016 04:55 AM

Hi Fabrice 
 
We are glad that the issue is resolved at your end and please let us know if you need further assistance. 
 
With Regards, 
Gayathri R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;