pdf2swf 和pdf2html 使用命令详解

pdf2swf 将pdf文档转换为flash方式阅读,可以满足公式、图片的格式定义;

pdf2htmlEX 将pdf文档转换为html方式阅读,有一下优点:

  • 在HTML文件中精确显示原生文本
    • 保持PDF中的字体,颜色,位置
    • 可以选择,复制,搜索
  • 生成的文件大小与解压缩后的PDF文件相当,如果放到支持HTTP压缩的服务器上,网络消耗和PDF相当

1、pdf2swf 命令

  其中把pdf转成swf的工具就是pdf2swf了。在命令行中运行pdf2swf src.pdf des.swf一般能满足需求。而命令行参数可以通过pdf2swf -f得到:
-h , –help                      Print short help message and exit              打印帮助信息
-V , –version                Print version info and exit                        打印版本号
-o , –output file.swf         Direct output to file.swf. If file.swf contains ‘13568621′ (file13568630.swf), then each page指定输出的swf文件名
-p , –pages range             Convert only pages in range with range e.g. 1-20
or 1,4,6,9-11 or

指定转换的页面范围,使用的页码描述方法与打印机打印文件时候的选页一样

-P , –password password       Use password for deciphering the pdf.指定打开pdf的密码
-v , –verbose                 Be verbose. Use more than one -v for greater effect.转换时输出详细的内容
-z , –zlib                    Use Flash 6 (MX) zlib compression.使用Flash 6的zlib压缩机制
-i , –ignore                  Allows pdf2swf to change the draw order of the pdf. This may make the generated允许程序修改pdf的绘制顺序,可能会导致结果与原来有差异
-j , –jpegquality quality     Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)设置转换其中的jpeg图片的质量,从0到100,默认值是85。
-s , –set param=value         Set a SWF encoder specific parameter.  See pdf2swf -s help for more information.  设置SWF转码时候的参数,具体参数可以用pdf2swf -s help获取
-w , –samewindow              When converting pdf hyperlinks, don’t make the links open a new window.        设置转换后的swf打开原pdf中的连接时使用相同的窗口
-t , –stop                    Insert a stop() command in each page.            在每页结尾添加一个stop()命令
-T , –flashversion num        Set Flash Version in the SWF header to num.         设置SWF所使用的flash版本号
-F , –fontdir directory       Add directory to the font search path.                    指定字体文件所在路径
-b , –defaultviewer           Link a standard viewer to the swf file.             指定默认的swf导航文件,用来翻页、放大缩小等等
-l , –defaultloader           Link a standard preloader to the swf file which will be displayed while the main swf is loading.     指定默认的swf加载文件,用来显示加载进程效果
-B , –viewer filename         Link viewer filename to the swf file.   指定swf导航文件,作用同-b
-L , –preloader filename      Link preloader filename to the swf file.      指定swf加载文件,作用同-l
-q , –quiet                   Suppress normal messages.  Use -qq to suppress warnings, also.  不打印普通信息,用-qq就不打印警告信息。
-S , –shapes                  Don’t use SWF Fonts, but store everything as shape. 不使用字体,所有都转为形状。
-f , –fonts                   Store full fonts in SWF. (Don’t reduce to used characters). 在swf中保存全部字体。
-G , –flatten                 Remove as many clip layers from file as possible. 在文件中尽量去除影片层,合并它们
-I , –info                    Don’t do actual conversion, just display a list of all pages in the PDF. 不做实际转换,仅显示PDF的信息。
-Q , –maxtime n               Abort conversion after n seconds. Only available on Unix. 如果运行时间超时则退出。

 

2、pdf2htmlEx 命令详解

  

pdf2htmlEX的一些参数 可以设置生成文件的地址,生成那些文件什么的。

  1. 用法: pdf2htmlEX [options] <input.pdf> [<output.html>]  

  2.   -f,--first-page <int>         需要转换的起始页 (默认: 1)  

  3.   -l,--last-page <int>          需要转换的最后一页 (默认: 2147483647)  

  4.   --zoom <fp>                   缩放比例  

  5.   --fit-width <fp>              适合宽度 <fp> 像素  

  6.   --fit-height <fp>             适合高度 <fp> 像素  

  7.   --use-cropbox <int>           使用剪切框 (default: 1)  

  8.   --hdpi <fp>                   图像水平分辨率 (default: 144)  

  9.   --vdpi <fp>                   图像垂直分辨率 (default: 144)  

  10.   --embed <string>              指定哪些元素应该被嵌入到输出  

  11.   --embed-css <int>             将CSS文件嵌入到输出中 (default: 1)  

  12.   --embed-font <int>            将字体文件嵌入到输出中 (default: 1)  

  13.   --embed-image <int>           将图片文件嵌入到输出中 (default: 1)  

  14.   --embed-javascript <int>      将javascript文件嵌入到输出中 (default: 1)  

  15.   --embed-outline <int>         将链接嵌入到输出中 (default: 1)  

  16.   --split-pages <int>           将页面分割为单独的文件 (default: 0)  

  17.   --dest-dir <string>           指定目标目录 (default: ".")  

  18.   --css-filename <string>       生成的css文件的文件名 (default: "")  

  19.   --page-filename <string>      分割的网页名称  (default:"")  

  20.   --outline-filename <string>   生成的链接文件名称 (default:"")  

  21.   --process-nontext <int>       渲染图行,文字除外 (default: 1)  

  22.   --process-outline <int>       在html中显示链接 (default: 1)  

  23.   --printing <int>              支持打印 (default: 1)  

  24.   --fallback <int>              在备用模式下输出 (default: 0)  

  25.   --embed-external-font <int>   嵌入局部匹配的外部字体 (default: 1)  

  26.   --font-format <string>        嵌入的字体文件后缀 (ttf,otf,woff,svg) (default: "woff")  

  27.   --decompose-ligature <int>    分解连字-> fi (default:0)  

  28.   --auto-hint <int>             使用fontforge的autohint上的字体时不提示 (default: 0)  

  29.   --external-hint-tool <string> 字体外部提示工具 (overrides --auto-hint) (default: "")  

  30.   --stretch-narrow-glyph <int>  伸展狭窄的字形,而不是填充 (default: 0)  

  31.   --squeeze-wide-glyph <int>    收缩较宽的字形,而不是截断 (default: 1)  

  32.   --override-fstype <int>       clear the fstype bits in TTF/OTF fonts (default:0)  

  33.   --process-type3 <int>         convert Type 3 fonts for web (experimental) (default: 0)  

  34.   --heps <fp>                   合并文本的水平临界值,单位:像素(default: 1)  

  35.   --veps <fp>                   vertical threshold for merging text, in pixels (default: 1)  

  36.   --space-threshold <fp>        断字临界值 (临界值 * em) (default:0.125)  

  37.   --font-size-multiplier <fp>   一个大于1的值增加渲染精度 (default: 4)  

  38.   --space-as-offset <int>       把空格字符作为偏移量 (default: 0)  

  39.   --tounicode <int>             如何处理ToUnicode的CMap (0=auto, 1=force,-1=ignore) (default: 0)  

  40.   --optimize-text <int>         尽量减少用于文本的HTML元素的数目 (default: 0)  

  41.   --bg-format <string>          指定背景图像格式 (default: "png")  

  42.   -o,--owner-password <string>  所有者密码 (为了加密文件)  

  43.   -u,--user-password <string>   用户密码 (为了加密文件)  

  44.   --no-drm <int>                覆盖文档的 DRM 设置 (default: 0)  

  45.   --clean-tmp <int>             转换后删除临时文件 (default: 1)  

  46.   --data-dir <string>           指定的数据目录 (default: ".sharepdf2htmlEX")  

  47.   --debug <int>                 打印调试信息 (default: 0)  

  48.   -v,--version                  打印版权和版本信息  

  49.   -h,--help                     打印使用帮助信息

原文地址:https://www.cnblogs.com/paxing/p/5796657.html