Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Oct 26, 2023 2:19 pm

Hello,

I am trying to convert incoming .pdf reports into corresponding .jpeg files (one per page) and for some reason it is not working for me at the moment, I am using the following code:

Code: Select all
      ofdGetPDFFile.Filter = "PDF Documents|*.pdf"
      If ofdGetPDFFile.ShowDialog = DialogResult.OK Then
         Dim pdf As PdfDocument = New Spire.Pdf.PdfDocument
         pdf.LoadFromFile(ofdGetPDFFile.FileName)
         Dim i = 1
         'Loop through all pages in the document
         For Each page As PdfPageBase In pdf.Pages
            'Extract images from each page and save them to a specified file path
            For Each image As Image In page.ExtractImages()
               image.Save($"c:/epdehrs/temp/images/{IO.Path.GetFileName(ofdGetPDFFile.FileName)}{i}.jpeg", Drawing.Imaging.ImageFormat.Jpeg)
               i += 1
            Next
         Next
      End If


and it does produce an image, however content does not seem to match what i am seeing on the original .pdf document
maybe content i am trying to access can't be accessed that way .. i am going to attach a few samples so hopefully you could guide me in the right direction

Regards,
Alex

AlexFMarGA
 
Posts: 1
Joined: Wed Sep 27, 2023 4:22 pm

Fri Oct 27, 2023 2:28 am

Hi Alex,

Thanks for your feedback.
I have tested the latest commercial version of our Spire.PDF_9.10.2, and during my testing, I found that the converted images maintain a high level of quality and fidelity compared to the source documents. To help address your concern, I have attached a sample of the converted image for your reference. Please review it and compare it with your output.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF