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();
}