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.

Fri Jun 16, 2023 5:54 am

I'm trying to convert HTML to PDF, But it's cropping to content in generated PDF.

1. Sample HTML input file and PDF output file attached.
2. Code Snippet:

Code: Select all
public static String convertHtmlToPdf(String htmlString) throws IOException {

      Path tempFile = Files.createTempFile("output", ".html");

      try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(tempFile.toFile().getPath()),
            StandardCharsets.UTF_8)) {
         writer.append(htmlString);
         writer.newLine();
      } catch (IOException e) {
         throw e;
      }

      logger.info("temp file created: " + tempFile.toFile().getPath());

      File outputFile = File
            .createTempFile("output_pdf_" + new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()), ".pdf");

      // Set license key
      com.spire.license.LicenseProvider.setLicenseKey(LICENSE_KEY);

      // Set plugin path
      HtmlConverter.setPluginPath(PLUGIN_PATH);

      // Convert HTML string to PDF
      HtmlConverter.convert(tempFile.toFile().getPath().toString(), new FileOutputStream(outputFile), true,
            1000000000, new Size(700, 900), new PdfMargins(40, 40, 40, 40));
      logger.info("outputResource.getFile().length() " + outputFile.length());

      return outputFile.getAbsolutePath();

   }


3. Spire PDF version:
Manifest-Version: 1.0
Extension-Name: spire.pdf
Implementation-Title: spire.pdf for java
Implementation-Version: 4.8.7
Implementation-Vendor: E-iceblue Co., Ltd
Implementation-Vendor-Id: com.spire

4. Application Type: Spingboot JDK 1.8
Attachments
input output files.zip
Sample input and output files
(59.42 KiB) Downloaded 411 times

Dasgupta
 
Posts: 54
Joined: Fri Mar 11, 2022 9:14 am

Fri Jun 16, 2023 10:12 am

Hello,

Thank you for your inquiry.
I have tested your HTML file and reproduced the issue you mentioned. I have logged the issue into our issue tracking system with the ticket number SPIREPDF-6075. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Mon Jun 19, 2023 5:02 am

Hello,

Thanks for the quick response.

Do we have any update on SPIREPDF-6075.

Thanks and regards

Dasgupta
 
Posts: 54
Joined: Fri Mar 11, 2022 9:14 am

Mon Jun 19, 2023 7:06 am

Hello,

Thanks for following up.
I'm sorry that the issue SPIREPDF-6075 has not been resolved, our development team is still working hard to investigate it. As soon as there is an important update, I will keep you informed. Thanks for your understanding.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Wed Jun 21, 2023 3:54 pm

Hello,

Do we have any update on SPIREPDF-6075?

Thanks and regards

Dasgupta
 
Posts: 54
Joined: Fri Mar 11, 2022 9:14 am

Thu Jun 22, 2023 2:35 am

Hi,

Thanks for your following-up.
I'm sorry that the issue SPIREPDF-6075 has not been resolved. Since we are on the Chinese Dragon Boat Festival holiday, I will urge our developers to speed up the repair when we return to the office at the end of this weekend's holiday. Sorry for the inconvenience caused.

Best regards,
Triste
E-iceblue support team
User avatar

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

Mon Jun 26, 2023 5:22 am

Hello,

This issue is blocking for us. I request you to provided any solution as soon as possible.

Dasgupta
 
Posts: 54
Joined: Fri Mar 11, 2022 9:14 am

Mon Jun 26, 2023 8:43 am

Hello,

Thank you for your further follow-up.
Regarding issue SPIREPDF-6075, due to the involvement of third-party QT plugins, our development team is facing significant difficulties in investigating the root cause. Nevertheless, we are still making great efforts to find a solution. Once there are any significant updates, I will inform you immediately. Sorry for the inconvenience caused again.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Wed Jul 05, 2023 9:35 am

Hello,

Any update on SPIREPDF-6075 please?

Regards,

Dasgupta
 
Posts: 54
Joined: Fri Mar 11, 2022 9:14 am

Wed Jul 05, 2023 10:01 am

Hello,

Thank you for the follow-up.
We regret to inform you that the issue SPIREPDF-6075 has not been fully resolved at this time. We are actively pushing our development team to diligently work towards resolving the problem as quickly as possible.

We sincerely apologize for any inconvenience caused and deeply regret the impact this may have on your experience.

We appreciate your understanding, patience, and continued support in addressing this matter. If you have any further questions or concerns, please do not hesitate to let us know.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Wed Jul 12, 2023 5:37 am

Hello,

Any update on SPIREPDF-6075 please?

Regards,

Dasgupta
 
Posts: 54
Joined: Fri Mar 11, 2022 9:14 am

Wed Jul 12, 2023 8:49 am

Hello,

Thank you for your follow-up.
Our development team has conducted a thorough investigation and found that the "@page" style tag in your HTML file needs to be removed in order to display the complete content after converting it to a PDF file. Additionally, due to the wide content width of your HTML file, the PDF file's width needs to be adjusted accordingly. Please find attached our modified HTML file and the resulting file for your reference.
If you have any further questions or require additional assistance, please don't hesitate to let us know. We are here to help.


Sincerely,
Annika
E-iceblue support team
Attachments
attachment.zip
(56.43 KiB) Downloaded 375 times
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS