Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does wkhtmltopdf assist the back end to export third-party software for complex pdf files

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you the third-party software about how wkhtmltopdf helps the back end to export complex pdf files. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

(1) definition of terms

Document object

"document object" refers to the document object in an PDF document. There are three types of "document object". They are "page object", "cover object" and "directory object".

Page object

A "page object" is an object that is rendered in a PDF document in the form of a page, as opposed to "cover object" and "catalog object". Such objects become content in the PDF document.

Cover object

A "cover object" is an object that is presented in a PDF document as a cover. Such objects will become the cover of the PDF document.

Directory object

A "directory object" is an object rendered in an PDF document in the form of a directory, also known as a "TOC object". Such objects become directories in the PDF document.

Outline

"outline" refers to the bookmark navigation when reading PDF documents.

Outer chain

"Outer chain" refers to all hyperlinks that are on this page and do not point to anchors in its own page.

Inner chain

An "inner chain" is a hyperlink in this page that points to a target page that is an anchor in the page itself.

(2) Command format wkhtmltopdf [GLOBAL OPTION]... [OBJECT]...

The above code is the command line format of wkhtmltopdf, which seems simple, but there are different holes in [GLOBAL OPTION] and [OBJECT]. If you know the details, listen to me slowly.

(3) General options for parameters

-allow allows you to load files or files from a specified folder (repeatable)

-book* sets the options you usually set when printing a book at a time

-collate collates when printing multiple copies

-cookie sets an additional cookie (repeatable)

-cookie-jar reads and writes Cookie, and in the provided cookie jar file

-number of copies copied and printed into pdf files (default is 1)

-cover* uses the HTML file as the cover. It will be inserted before TOC with header and footer

-custom-header sets an additional HTTP header (repeatable)

-javascript debug output displayed by debug-javascript

-default-header* adds a default header, with the name on the left side of the page, and the number of pages to the right, for example:-header-left'[webpage]'- header-right'[page] / [toPage]'- header-line

-disable-external-links* prohibits the generation of links to remote web pages-disable-internal-links* prohibits the use of local links-disable-javascript prohibits web pages from performing JavaScript

-disable-pdf-compression* prohibits lossless compression on PDF objects

-disable-smart-shrinking* forbids the use of WebKit's smart strategy to shrink, leaving the pixel / DPI ratio unchanged.

-disallow-local-file-access forbids translating local files from reading other local files unless explecitily allows-allow

-dpi explicitly changes DPI (this has no impact on X11-based systems)

-enable-plugins enables installed plug-ins (such as Flash-encoding to set the default text encoding

-extended-help shows a wider range of help, detailing unusual command switches

-forms* opens HTML form fields and converts them to PDF form fields

-grayscale PDF format will be generated in gray scale-help Display help

-htmldoc output program HTML help-ignore-load-errors ignores that an error page has been encountered during claimes loading

-lowquality produces low quality PDF/ PS. Useful to reduce the space of the resulting document

-manpage output program man page

-margin-bottom sets the bottom margin of the page (default 10mm)

-margin-left sets the left margin (default 10mm)

-margin-right sets the right margin of the page (default 10mm)

-margin-top sets the top margin of the page (default 10mm)

-minimum-font-size minimum font size (default 5)

-no-background does not print background-orientation sets orientation to landscape or portrait

-page-height page height (default unit millimeter)

-page-offset* sets the starting page number (default 1)

-page-size sets the paper size: A4, Letter, etc.

-page-width page width (default unit millimeter)

-password HTTP authentication password

-post Add an additional post field (repeatable)

-post-file Post an aditional file (repeatable)

-the type of print media used by print-media-type*, not the screen

-proxy uses proxy

-quiet Be less verbose

-read-args-from-stdin reads standard input command line arguments

-readme output program README-redirect-delay waits a few milliseconds for JS- redirection (default 200)

-replace* replace the name, header and footer of the value (repeatable)

-stop-slow-scripts stops running slow JavaScripts

-title of the PDF file generated by title (the title of the first document is used, if not specified)

-the beginning of the file in the table of the contents inserted by toc*-use-xserver* uses an X server (some plug-ins and other things may not work without X11)

-user-style-sheet specifies the user's stylesheet, loaded on each page-username HTTP authenticated user name

-version output version information exit-zoom uses this zoom factor (default 1)

Header and footer options

-header-center* (header content set in the central location)

-header-font-name* (default Arial) (sets the font name of the header)

-header-font-size* (sets the font size of the header)

-header-html* (add a HTML header followed by a URL)

-header-left* (left-aligned header text)

-header-line* (shows a line under the header)

-header-right* (right-aligned header text)

-header-spacing* (sets the distance between header and content. Default is 0)

-footer-center* (footer content set in the center)

-footer-font-name* (sets the font name of the footer)

-footer-font-size* (sets the font size of the footer default 11)

-footer-html* (add a HTML footer followed by a URL)

-footer-left* (left-aligned footer text)

-footer-line* displays a line on the footer)

-footer-right* (right-aligned footer text)

-footer-spacing* (sets the distance between the footer and the content)

. / wkhtmltopdf-footer-right'[page] / [topage] 'https://www.baidu.com baidu.pdf

. / wkhtmltopdf-header-center 'report'-header-line-margin-top 2cm-header-line http://192.168.212.139/oma/ oma.pdf

Table content options

-toc-depth* Set the depth of the toc (default 3)

-toc-disable-back-links* Do not link from section header to toc

-toc-disable-links* Do not link from toc to sections

-toc-font-name* Set the font used for the toc (default Arial)

-toc-header-font-name* The font of the toc header (if unset use-toc-font-name)

-toc-header-font-size* The font size of the toc header (default 15)

-toc-header-text* The header text of the toc (default Table Of Contents)

-toc-l1-font-size* Set the font size on level 1 of the toc (default 12)

-toc-l1-indentation* Set indentation on level 1 of the toc (default 0)

-toc-l2-font-size* Set the font size on level 2 of the toc (default 10)

-toc-l2-indentation* Set indentation on level 2 of the toc (default 20)

-toc-l3-font-size* Set the font size on level 3 of the toc (default 8)

-toc-l3-indentation* Set indentation on level 3 of the toc (default 40)

-toc-l4-font-size* Set the font size on level 4 of the toc (default 6)

-toc-l4-indentation* Set indentation on level 4 of the toc (default 60)

-toc-l5-font-size* Set the font size on level 5 of the toc (default 4)

-toc-l5-indentation* Set indentation on level 5 of the toc (default 80)

-toc-l6-font-size* Set the font size on level 6 of the toc (default 2)

-toc-l6-indentation* Set indentation on level 6 of the toc (default 100)

-toc-l7-font-size* Set the font size on level 7 of the toc (default 0)

-toc-l7-indentation* Set indentation on level 7 of the toc (default 120)

-toc-no-dots* Do not use dots, in the toc

Outline option

-dump-outline dump directory to a file

-outline display table of contents (determined by h ~ 2 ~ # h _ 3 in the article)

-outline-depth sets the depth of the directory (default is 4)

Footer and header

[page] replaced by the number of pages currently being printed

[frompage] replaced by the number of first pages to be printed

[topage] replaced by the number of last page to be printed

[webpage] replace through the URL of the page being printed

[section] is replaced by the name of the current section

[subsection] is replaced by the name of the current section

[date] replaced by the local format of the current date system

[time] replaced by the current time, the local format of the system

The above is the third-party software that the editor shares with you how wkhtmltopdf helps the back end export complex pdf files. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report