Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Jul 29, 2024 6:08 am

Hello,

I am using Spire.XLS to convert Excel files to PDF. When performing the conversion on my local environment, everything works fine. However, when I do the same on the validation environment, the width of the PDF output becomes larger, which is causing issues.

I have tested with both the Free version and the Trial version.

Environment Information:

Local: Windows 11 64-bit
Validation Environment: Ubuntu 24.04 LTS
Versions Used: Spire.XLS Free: 5.1.0, Spire.XLS: 14.7.5

To ensure general applicability, I am following the Excel print settings for the output and have not specified output settings in the source code.
Could you please assist me with this issue?

Code: Select all
try (InputStream is = url.openStream()) {
      com.spire.xls.Workbook spireWorkbook = new com.spire.xls.Workbook();
      spireWorkbook.loadFromStream(is);

      com.spire.xls.Worksheet sheet = spireWorkbook.getWorksheets().get(0);

      ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();
      spireWorkbook.saveToStream(pdfStream, com.spire.xls.FileFormat.PDF);

        response.setHeader("Content-Disposition", "inline; filename=\"" + XXX + ".pdf\"");
        response.setContentType("application/pdf");
        response.setContentLength(pdfStream.size());
        response.getOutputStream().write(pdfStream.toByteArray());
        response.getOutputStream().flush();
        response.getOutputStream().close();
}

s.yamazaki
 
Posts: 2
Joined: Mon Jul 29, 2024 5:37 am

Mon Jul 29, 2024 10:11 am

Hello!

Thank you for inquiry.
In order to help us locate your issue accurately, please provide us with the difference in the width of your two PDF documents, as well as your original input file. You can upload it here or send it to us via email (support@e-iceblue.com).Thank you in advance.

Sincerely,
Amin
E-iceblue support team
User avatar

Amin.Gan
 
Posts: 277
Joined: Mon Jul 15, 2024 5:40 am

Fri Aug 02, 2024 4:35 am

Thank you for your response.

I have attached the original Excel file and the PDFs generated on both Windows and Linux. However, the PDF generated on Linux is too large to attach, so I have included a screenshot instead. I apologize for the inconvenience this may cause.

Additionally, I would appreciate it if you could look into the issue of the PDF size becoming excessively large on Linux.

When comparing the PDFs, you can see that the output on Linux has the tables and objects expanded horizontally, causing the content to span two pages.

Please note that my English is not very good, so I have used Google Translate. I apologize if anything is unclear.

Thank you for your assistance.
Attachments
sample.zip
(1.68 MiB) Downloaded 309 times

s.yamazaki
 
Posts: 2
Joined: Mon Jul 29, 2024 5:37 am

Fri Aug 02, 2024 9:10 am

Hi,

Thank you for inquiry.
I did a preliminary test using the file you provided, but I did not reproduce you described problem. I attached my jar package(based on Jdk 1.8.0_412), you can use "java -jar xx.jar" to directly run it on your side and then let us know your testing result.

Sincerely,
Amin
E-iceblue support team
User avatar

Amin.Gan
 
Posts: 277
Joined: Mon Jul 15, 2024 5:40 am

Return to Spire.XLS