Other plug-ins that generate pdf include: weasyprint, reportlab, PyPDF2, etc., which are not as effective as pdfkit after simple tests, and some of them are complicated to use. The conversion effect is good for purely static pages. For ICONS generated by js code such as echarts and highcharts, pdf cannot be converted to pdf (because its function is mainly to convert html to pdf, rather than js to pdf). High fidelity, good conversion quality, and very simple to use.ġ. Chrome prints the current web page, and one option is to simply "save as PDF."Ģ.wkhtmltopdf USES the PDF rendering engine of the webkit kernel to convert the HTML page to PDF. Webkit is an efficient, open source browser kernel that is used by browsers including Chrome and Safari. It is the python I have been exposed to that has a good effect on generating pdf.ġ.wkhtmltopdf: convert HTML to PDF using the webkit kernel The program exports the PDF document methodġ.wkhtmltopdf is mainly used to generate PDF from HTML.Ģ.pdfkit is the python encapsulation based on wkhtmltopdf, which supports the conversion of URL, local files and text contents to PDF, and finally calls the wkhtmltopdf command. There are many limitations such as no support for templates and the ability to generate word documents in a simple format.Ģ. T = document.add_table(rows=1,cols=1,style = 'Table Grid') Table = document.add_table(rows=1, cols=3) 'first item in ordered list', style='ListNumber'ĭocument.add_picture('monty-truth.png', width=Inches(1.25)) 'first item in unordered list', style='ListBullet' P = document.add_paragraph('A plain paragraph having some ')ĭocument.add_heading('Heading, level 1', level=1)ĭocument.add_paragraph('Intense quote', style='IntenseQuote') Get the data from the web page and manually typeset it into the word document using python.ĭocument.add_heading('Document Title', 0) python-docx is an python library that can read and write word documents.ġ. The content format of the generated word document is not easy to control.ġ. If there are images generated by echarts,highcharts and other js codes in the page, these images cannot be converted into word documents ģ. Only static html can be converted, and not where data is asynchronously retrieved using ajax on the page (mainly to ensure that data is saved from the web page in the html file).Ģ. The conversion effect is also good, the method is very simple to use.ġ. Support the conversion of local html documents into docx documents, so you need to save the html files in the web page locally before calling unoconv for conversion. One of the most difficult things to solve is how to asynchronously retrieve populated data and export images to word documents using the js code.ġ. There are also some methods in php, but there are very few ways to generate world documents from web/html content in python. How the program exports the word documentĮxport web/html content into world documents, and then there are many solutions in java, such as using Jacob, Apache POI, Java2Word, iText, Java2Word, iText, and other ways, as well as using template engines such as freemarker.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |