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.

Fri Sep 08, 2023 2:47 am

I use FreeSpire.PDF 8.6.0 nuget package to convert pdf files to images, but the generated image only contains part of the pdf page.
Code: Select all
using (Spire.Pdf.PdfDocument pdfDocument = new Spire.Pdf.PdfDocument())
            {
                pdfDocument.LoadFromBytes(data);
                using (System.Drawing.Image image = pdfDocument.SaveAsImage(0, Spire.Pdf.Graphics.PdfImageType.Bitmap, 300, 300))
                {
                    MemoryStream memoryStream = new MemoryStream();
                    image.Save(memoryStream, ImageFormat.Jpeg);
                    return memoryStream.ToArray();
                }
            }

The attachments are the input pdf file and the generated image file respectively.

topsailgao
 
Posts: 4
Joined: Wed Jun 23, 2021 2:27 am

Fri Sep 08, 2023 9:29 am

Hi,

Thank you for your inquiry.
First, please kindly note that the free version of Spire.Pdf is limited to 10 pages of PDF. This limitation is enforced during loading and creating files. When converting PDF to Image, the first 3 pages of PDF files will be converted to Image format successfully. The pages number of your pdf file exceeded the Free version’s limitation, so I intercepted the first page of the PDF document you provided to test your scenario with Free Spire.Pdf, but I didn’t reproduce your issue. How did you handle this 50-page document to keep the number of pages under the free version limitation?
In addition, I also have converted all pages of your document to images using the latest commercial version of Spire.Pdf, and there have been no issues with missing content.I highly recommend that you use the latest commercial version of our Spire.PDF for .NET 9.8.5, you can download it through the link(https://www.e-iceblue.com/Download/download-pdf-for-net-now.html).
These are my test screenshots:
6.png

If those message above doesn’t help you, please offer the following information to help us do further investigation. Thank you in advance.

1)Your full test code that can reproduce your issue.
2)Application type, such as Console App, .NET Framework 4.8.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit).

Sincerely,
Ula
E-iceblue support team
Last edited by Ula.wang on Thu Sep 28, 2023 1:34 am, edited 1 time in total.
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Fri Sep 08, 2023 2:13 pm

Ula.wang wrote:Hi,

Thank you for your inquiry.
First, please kindly note that the free version of Spire.Pdf is limited to 10 pages of PDF. This limitation is enforced during loading and creating files. When converting PDF to Image, the first 3 pages of PDF files will be converted to Image format successfully. The pages number of your pdf file exceeded the Free version’s limitation, so I intercepted the first page of the PDF document you provided to test your scenario with Free Spire.Pdf, but I didn’t reproduce your issue. How did you handle this 50-page document to keep the number of pages under the free version limitation?
In addition, I also have converted all pages of your document to images using the latest commercial version of Spire.Pdf, and there have been no issues with missing content.I highly recommend that you use the latest commercial version of our Spire.PDF for .NET 9.8.5, you can download it through the link(https://www.e-iceblue.com/Download/download-pdf-for-net-now.html).
These are my test screenshots:
6.png

If those message above doesn’t help you, please offer the following information to help us do further investigation. Thank you in advance.

1)Your full test code that can reproduce your issue.
2)Application type, such as Console App, .NET Framework 4.8.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit).

Sincerely,
Ula
E-iceblue support team


Thanks for your reply, in our project, I only need to process the first page.
I rechecked the code and confirmed that the error was caused by the code that read the PDF file.

topsailgao
 
Posts: 4
Joined: Wed Jun 23, 2021 2:27 am

Mon Sep 11, 2023 3:10 am

Hi,

Thank you for your feedback.
If you have any question, just feel free to write back. I hope you have a wonderful day.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.PDF