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.

Mon Feb 27, 2023 4:22 pm

Testing your (free version) JAR with some sample PDF files, when following your code here Tutorials/ JAVA/ Spire.PDF-for-JAVA/ Program-Guide/ Conversion/ Convert-PDF-to-Image-in-Java.html, the resultant PNG files are generated where the actual page-image is in the lower left corner of the file -- maybe roughly 20% of the image, and the rest of the image ("canvas") is blank.

I would expect the page-image to be the full size of the canvas.

NOTE: That I am using dpi = 96, because setting dpi too high quickly causes a heap violation.

Do you have an updated sample code that saves an image from a PDF page where the image is scaled correctly?

Thank you,
AJ

aweber1nj
 
Posts: 4
Joined: Mon Feb 13, 2023 4:20 pm

Tue Feb 28, 2023 5:47 am

Hi,

Thanks for your inquiry.
I did an initial test, but I did not reproduce your issue. To help us do an accurate investigation, could you please provide us with your test document and output image? You can send them to us via email (support@e-iceblue.com) or attach them here. Thanks for your assistance.
In addition, you can try our commercial version, which is more powerful and stable. We are willing to provide you with a temporary license (one month free) to help you evaluate our products better. If you need, just let us know.

Sincerely,
Triste
E-iceblue support team
User avatar

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

Wed Mar 01, 2023 2:39 pm

(Email Sent per your request)

aweber1nj
 
Posts: 4
Joined: Mon Feb 13, 2023 4:20 pm

Thu Mar 02, 2023 3:05 am

Hi,

Thanks for your feedback.
I tested your document, but I did not reproduce your issue. I have sent my project and output image for your reference via email, you can open the project in IDEA and run it. If the issue still exists in your side, please provide us with the following message. Thanks for your assistance.
1) Your test environment, such as OS info (E.g., Windows 10 64bit) and region setting (E.g., China, Chinese).

Sincerely,
Triste
E-iceblue support team
User avatar

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

Thu Mar 02, 2023 4:45 pm

Built and ran your test harness on my machine and I still get the same results.

I am building and running against Java 1.8.0_121 (x64) on Windows 11 Pro (US en).

aweber1nj
 
Posts: 4
Joined: Mon Feb 13, 2023 4:20 pm

Fri Mar 03, 2023 6:26 am

Hi,

Thanks for your feedback.
After investigating, I found this issue was caused by the system scale.
scale.png

If I set the value higher than 100%, I will reproduce your issue, the scale of the output image will be wrong, please reset the value to 100% and have a test.
If the issue still exists, just feel free to contact us.

Sincerely,
Triste
E-iceblue support team
User avatar

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

Fri Mar 03, 2023 1:41 pm

Why are you using the scale of a particular display? Generating an image should be independent of the PC (or server's) specific video output - unless you're going to auto-scale the image when it is displayed on another display on another computer...which I do not think you can do.

Even if you are using the scale of the display (which I still disagree with), why would you leave the image canvass at a [much] larger dimension than the actual image you scaled?

Creating the image of the PDF-page should be consistent from machine-to-machine.

aweber1nj
 
Posts: 4
Joined: Mon Feb 13, 2023 4:20 pm

Mon Mar 06, 2023 9:33 am

Hi,

Thank you for your feedback.
This issue is caused by the image processing logic in our product. When creating a bitmap using Spire.PDF, it uses page.getBounds(), but the size of bounds is calculated based on screenResolution, which leads to differences in bitmap size.

In our commercial version, this issue has been fixed. Since we maintain our free edition irregularly, for your situation, I suggest that you use our commercial version, which is more powerful and includes more bug fixes. We would be happy to provide you with a temporary license (one month free) to help you evaluate our Spire.PDF better. If you are interested, please let us know.

Sincerely,
Triste
E-iceblue support team
User avatar

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

Return to Spire.PDF