将网页保留格式在线打印为PDF文档

简介:          如果使用浏览器自身的打印功能,网页排版格式往往不能保留。但是使用PDFMYURL的在线打印功能则能很好的解决这个问题,不但可以将有价值的互联网网页直接打印为PDF文档,而且保留了格式,甚至其中的链接资源。
         如果使用浏览器自身的打印功能,网页排版格式往往不能保留。但是使用PDFMYURL的在线打印功能则能很好的解决这个问题,不但可以将有价值的互联网网页直接打印为PDF文档,而且保留了格式,甚至其中的链接资源。很简单,很实用,很…
         (一)使用方法是将网页链接输入pdfmyurl对话框,点击生成 即可。
         (二)将这个功能添加到自己的博客或网站,仅需要加入以下代码(以本网页为例):
                  <a href=http://pdfmyurl.com?url=www.readwiki.com/geophysics>打印本页为PDF文档</a>
效果如:打印本页为PDF文档
         (三)其他高级设置如:自定义打印名称,加头部说明,打印纸张大小,代理设置,页面留空宽度,都可以通过参数予以控制。
                  <a href="http://pdfmyurl.com?url=www.readwiki.com/geophysics&amp;-O=Landscape&amp;--header-left=hi&amp;--filename=name.pdf">打印本页</a>


Advanced Options
       How to use / insert pdfmyurl in your own site
              Simply link the text or image you want people to use for downloading a specific page/url like this:
                     http://pdfmyurl.com?url=www.opentracker.net 
       for example:
              <a href="http://pdfmyurl.com?url=www.opentracker.net">downlaod this page as pdf</a> 
       will create a text link that looks like this: 
              download this page as pdf
       How to use on your server
       Synopsis (the first -O <filename> is wget's own output file option):
              wget -O opentracker.pdf "pdfmyurl.com?url=www.opentracker.net&-O=Landscape&--header-left=hello"
       General Options:
              You can mix-and-match the underneath options to customize the pdf to your needs.
       For example, if you want a landscaped pdf you add-O=Landscape or --orientation=Landscape and if you want to add a header with text aligned to the left you would use--header-left=hi. You can also alter the default filename by providing the --filename=ot.pdf option.
       These three options combined in one text link would look like this:
              <a href="http://pdfmyurl.com?url=opentracker.net&-O=Landscape&--header-left=hi&--filename=ot.pdf">pdf</a> 
       Notice that in the above example the ampersand "&" sign separates each option, and the separating character for a parameter is an equals "=" sign. You will need to url escape any reserved url characters for option values.
     --original-url                        Set the --header-right parameter to be the url of the created pdf page.
     --filename <filename>           Set the filename to download, default is a filename made from the url.
 -O, --orientation <orientation>     Set orientation to Landscape or Portrait
 -s, --page-size <size>              Set paper size to: A4, Letter, etc.
 -p, --proxy <proxy>                 Use a proxy
     --username <username>           HTTP Authentication username
     --password <password>           HTTP Authentication password
     --custom-header <name> <value>  Set an additional HTTP header (single)
 -b, --book                          Set the options one would usually set when 
                                     printing a book
     --cover <url>                   Use html document as cover. It will be 
                                           inserted before the toc with no headers
                                     and footers
 -H, --default-header                Add a default header, with the name of the
                                     page to the left, and the page number to
                                     the right, this is short for:
                                     --header-left='[webpage]'
                                     --header-right='[page]/[toPage]' --top 2cm
                                     --header-line
 -t, --toc                           Insert a table of content in the beginning
                                     of the document
 -d, --dpi <dpi>                     Change the dpi explicitly (this has no
                                     effect on X11 based systems)
     --page-height <unitreal>        Page height (default unit millimeter)
     --page-width <unitreal>         Page width  (default unit millimeter)
 -n, --disable-javascript            Do not allow web pages to run javascript
 -g, --grayscale                     PDF will be generated in grayscale
 -l, --lowquality                    Generates lower quality pdf/ps. Useful to
                                     shrink the result document space
 -B, --margin-bottom <unitreal>      Set the page bottom margin (default 10mm)
 -L, --margin-left <unitreal>        Set the page left margin (default 10mm)
 -R, --margin-right <unitreal>       Set the page right margin (default 10mm)
 -T, --margin-top <unitreal>         Set the page top margin (default 10mm)
     --redirect-delay <msec>         Wait some milliseconds for js-redirects
                                     (default 200)
     --enable-plugins                Enable installed plugins (such as flash)
     --zoom <float>                  Use this zoom factor (default 1)


     --disable-internal-links        Do no make local links
     --disable-external-links        Do no make links to remote web pages
     --print-media-type              Use print media-type instead of screen
     --page-offset <offset>          Set the starting page number (default 1)
     --disable-smart-shrinking       Disable the intelligent shrinking strategy
                                     used by WebKit that makes the pixel/dpi
                                     ratio none constant
     --encoding <encoding>           Set the default text encoding, for input
     --no-background                 Do not print background
     --user-style-sheet <url>        Specify a user style sheet, to load with
                                     every page


Headers And Footer Options:
     --footer-center <text>          Centered footer text
     --footer-font-name <name>       Set footer font name (default Arial)
     --footer-font-size <size>       Set footer font size (default 11)
     --footer-left <text>            Left aligned footer text
     --footer-line                   Display line above the footer
     --footer-right <text>           Right aligned footer text
     --footer-spacing <real>         Spacing between footer and content in mm (default 0)
     --footer-html <url>             Adds a html header
     --header-center <text>          Centered header text
     --header-font-name <name>       Set header font name (default Arial)
     --header-font-size <size>       Set header font size (default 11)
     --header-left <text>            Left aligned header text
     --header-line                   Display line below the header
     --header-right <text>           Right aligned header text
     --header-spacing <real>         Spacing between header and content in mm (default 0)
     --header-html <url>             Adds a html header


Table Of Content Options:
     --toc-font-name <name>          Set the font used for the toc (default Arial)
     --toc-no-dots                   Do not use dots, in the toc
     --toc-depth <level>             Set the depth of the toc (default 3)
     --toc-header-text <text>        The header text of the toc (default Table Of Contents)
     --toc-header-fs <size>          The font size of the toc header (default 15)
     --toc-disable-links             Do not link from toc to sections
     --toc-disable-back-links        Do not link from section header to toc
     --toc-l1-font-size <size>       Set the font size on level 1 of the toc (default 12)
     --toc-l1-indentation <num>      Set indentation on level 1 of the toc (default 0)
     --toc-l2-font-size <size>       Set the font size on level 2 of the toc (default 10)
     --toc-l2-indentation <num>      Set indentation on level 2 of the toc (default 20)
     --toc-l3-font-size <size>       Set the font size on level 3 of the toc (default 8)
     --toc-l3-indentation <num>      Set indentation on level 3 of the toc (default 40)
     --toc-l4-font-size <size>       Set the font size on level 4 of the toc (default 6)
     --toc-l4-indentation <num>      Set indentation on level 4 of the toc (default 60)
     --toc-l5-font-size <size>       Set the font size on level 5 of the toc (default 4)
     --toc-l5-indentation <num>      Set indentation on level 5 of the toc (default 80)
     --toc-l6-font-size <size>       Set the font size on level 6 of the toc (default 2)
     --toc-l6-indentation <num>      Set indentation on level 6 of the toc (default 100)
     --toc-l7-font-size <size>       Set the font size on level 7 of the toc (default 0)
     --toc-l7-indentation <num>      Set indentation on level 7 of the toc (default 120)


Outline Options:
     --outline                       Put an outline into the pdf
     --outline-depth <level>         Set the depth of the outline (default 4)


Page sizes:
 The default page size of the rendered document is A4, but using this
 --page-size option this can be changed to almost anything else, such as: A3,
 Letter and Legal.  For a full list of supported pages sizes please see 
 http://doc.trolltech.com/4.6/qprinter.html#PageSize-enum.


 For a more fine grained control over the page size the --page-height and
 --page-width options may be used


目录
相关文章
|
2月前
|
应用服务中间件
使用 Adobe Livecycle Enterprise service 将 word 文档转换成 PDF 格式
使用 Adobe Livecycle Enterprise service 将 word 文档转换成 PDF 格式
28 0
|
3月前
|
Ubuntu Java Linux
在Spring Boot中使用iTextPDF创建动态PDF文档
iTextPDF 是一个用于创建和操作 PDF(Portable Document Format)文档的流行的 Java 库。它提供了一套全面的功能,用于处理 PDF 文件,包括创建新文档、修改现有文档以及提取信息。
86 1
|
2天前
|
人工智能 Python
【Python实用技能】建议收藏:自动化实现网页内容转PDF并保存的方法探索(含代码,亲测可用)
【Python实用技能】建议收藏:自动化实现网页内容转PDF并保存的方法探索(含代码,亲测可用)
21 0
|
1月前
|
数据采集 移动开发 前端开发
springboot使用html模版导出pdf文档
springboot使用html模版导出pdf文档
|
2月前
|
Java Linux 数据安全/隐私保护
Java【代码 16】将word、excel文件转换为pdf格式和将pdf文档转换为image格式工具类分享(Gitee源码)aspose转换中文乱码问题处理
【2月更文挑战第3天】Java 将word、excel文件转换为pdf格式和将pdf文档转换为image格式工具类分享(Gitee源码)aspose转换中文乱码问题处理
105 0
|
2月前
|
开发框架 前端开发 .NET
福利来袭,.NET Core开发5大案例,30w字PDF文档大放送!!!
为了便于大家查找,特将之前开发的.Net Core相关的五大案例整理成文,共计440页,32w字,免费提供给大家,文章底部有PDF下载链接。
35 1
福利来袭,.NET Core开发5大案例,30w字PDF文档大放送!!!
|
2月前
|
XML 持续交付 开发工具
SAPGUI 里 ABAP 代码导出成 PDF 格式的隐藏小技巧
SAPGUI 里 ABAP 代码导出成 PDF 格式的隐藏小技巧
27 0
|
3月前
|
存储
如何解决网页中的pdf文件无法下载?pdf打印显示空白怎么办?
如何解决网页中的pdf文件无法下载?pdf打印显示空白怎么办?
180 0
|
3月前
|
存储 Shell 数据安全/隐私保护
Python 自动化指南(繁琐工作自动化)第二版:十五、使用 PDF 和 WORD 文档
Python 自动化指南(繁琐工作自动化)第二版:十五、使用 PDF 和 WORD 文档
52 1
|
3月前
|
NoSQL 算法 Java
三面阿里云被虐,15天读完这份pdf文档,我拿下“美团通知单”
首先介绍一下我的个人背景,鄙人小康家庭,父母都是普通职业,供我读书长大不容易,好在我也算争气,高考发挥正常,考了个还算不错的大学,华南地区某211。今年的金三银四本是想好好拼一把,奈何受到疫情影响,只能将自己的计划缩减又缩减,所以第一家选择去面试的阿里,奈何三面被虐得“体无完肤”,好在自己并未气馁,复习15天后去面试了美团,最终4面拿下了offer。