This is a migrated thread and some comments may be shown as answers.

Convert pdf to image

1 Answer 296 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Stefania
Top achievements
Rank 2
Stefania asked on 13 Sep 2017, 03:11 PM

Hi

I use this code to convert pdf to List<image> but the resolution is not so high and the QR code inside the page is not detachable

Is there some way to improve the resolution (more DPI)?

 

public static List<ImageSource> ConvertPdfToImage(string filePath)
       {
           List<ImageSource> result = new List<ImageSource>();
           ThumbnailFactory tf = new ThumbnailFactory();
            
           using (Stream stream = File.Open(filePath, FileMode.Open))
           {               
               PdfFormatProvider formatProvider = new PdfFormatProvider(stream, FormatProviderSettings.ReadAllAtOnce);
               RadFixedDocument document = formatProvider.Import();
 
               foreach (RadFixedPage page in document.Pages)
               {
                   ImageSource pageImg = tf.CreateThumbnail(page, page.Size);
                    
                   result.Add(pageImg);
               }               
           }
           return result;
 
       }

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 18 Sep 2017, 08:49 AM
Hi Stefania,

The ThumbnailFactory class internally uses the .NET API to render an image from the document page and I am afraid that there is not much we can do to change the quality of the exported content. Is the image properly shown in RadPdfViewer?

Regards,
Tanya
Progress Telerik

Tags
PdfProcessing
Asked by
Stefania
Top achievements
Rank 2
Answers by
Tanya
Telerik team
Share this question
or