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 Jun 14, 2024 9:28 am

Dear Support,

I am currently working on a project that requires the usage of the Spire.PDF (Spire.Office) library (python based) to convert a PDF document to HTML. I have encountered some difficulties while attempting to convert pdf to html and would greatly appreciate your assistance.

The specifications of my environment are as follows:
Python Version : 3.9.10
Spire.Office (Python) Version : 9.1.0

I attempted to convert the pdf documents to html, but I encountered some conversion issues, I have followed both the approaches to consider SVG or Non-SVG :

I have also attached the document used for conversions and there converted html files.

SVG :

Source Code :

Code: Select all

PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Document3.pdf");
pdf.ConvertOptions.SetPdfToHtmlOptions(True, False, 1, False)
pdf.SaveToFile("Document3.html", FileFormat.HTML)



Issues :

The converted SVG file is not html friendly to update the elements to include some html input elements or style (css styling), as we have a requirement to embed some html elements and style we are not able consider SVG based conversions.

Non-SVG :

Source Code :

Code: Select all

PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Document3.pdf");
pdf.ConvertOptions.SetPdfToHtmlOptions(False, False, 1, False)
pdf.SaveToFile("Document3.html", FileFormat.HTML)



Issues :

The html file generated via Non-SVG is not in proper format as some of the elements are misplaced or not properly converted :
a. The grid structure are created as SVG and its content is misplaced.
b. The grid under 'Section 2' it's where we are required to add some input elements, and currently it is misplaced/SVG is being generated.
c. The flow chart in the pdf is not being rendered properly.

I would greatly appreciate any guidance or instructions you can provide to help me successfully convert the documents to a proper html where we can add some elements and styling.

Thank you very much for your attention and assistance. I look forward to your prompt response.

petchi_y
 
Posts: 7
Joined: Tue May 14, 2024 5:56 am

Fri Jun 14, 2024 10:12 am

Hello,

Thanks for your inquiry.
Sorry, currently Non-SVG way does have some performance issues when converting PDF to HTML. Due to technical reasons, we have not yet found a better solution. In order to obtain better conversion results, we generally recommend that customers use the embedded SVG way. Anyway, we have logged your issue in our tracking system with ticket SPIREPDF-6835 and our dev team will further look for a solution. We will let you know once it is fixed in the future. Thank you for your understanding.

Sincerely
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 419
Joined: Mon Dec 27, 2021 2:23 am

Fri Jul 19, 2024 12:56 am

Hi, I am also having similar issue.
I want to convert my pdf files to HTML which does not contain svg but maintain table format data as "<table>' tags and other bold styles etc.

Is it possible with Spire.PDF for Python?

And Please let me know your official Documentaion for Spire.PDF for Python.
Thank you.

Regards,
Jeong

JeongManAn
 
Posts: 1
Joined: Thu Jul 18, 2024 9:56 am

Fri Jul 19, 2024 9:30 am

Hello JeongManAn,

Thanks for your inquiry.
When not using SVG, the output effect of Spire PDF for Python also not very good. Our Dev team will optimize it. Once an optimized version is released, I will notify you as soon as possible.

In addition, you can learn more about the features of Spire PDF for Python from the following link, or you can download our product package to your local and unzip it. There are many examples under the "Demos" folder.
https://www.e-iceblue.com/Tutorials/Python/Spire.PDF-for-Python/Program-Guide/Spire.PDF-for-Python-Program-Guide-Content.html
If you have any other questions, please feel free to contact us at any time.

Sincerely,
Amin
E-iceblue support team

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

Return to Spire.PDF