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的一些參數 可以設置生成文件的地址,生成那些文件什么的。
-
用法: pdf2htmlEX [options] <input.pdf> [<output.html>]
-
-f,--first-page <int> 需要轉換的起始頁 (默認: 1)
-
-l,--last-page <int> 需要轉換的最后一頁 (默認: 2147483647)
-
--zoom <fp> 縮放比例
-
--fit-width <fp> 適合寬度 <fp> 像素
-
--fit-height <fp> 適合高度 <fp> 像素
-
--use-cropbox <int> 使用剪切框 (default: 1)
-
--hdpi <fp> 圖像水平分辨率 (default: 144)
-
--vdpi <fp> 圖像垂直分辨率 (default: 144)
-
--embed <string> 指定哪些元素應該被嵌入到輸出
-
--embed-css <int> 將CSS文件嵌入到輸出中 (default: 1)
-
--embed-font <int> 將字體文件嵌入到輸出中 (default: 1)
-
--embed-image <int> 將圖片文件嵌入到輸出中 (default: 1)
-
--embed-javascript <int> 將javascript文件嵌入到輸出中 (default: 1)
-
--embed-outline <int> 將鏈接嵌入到輸出中 (default: 1)
-
--split-pages <int> 將頁面分割為單獨的文件 (default: 0)
-
--dest-dir <string> 指定目標目錄 (default: ".")
-
--css-filename <string> 生成的css文件的文件名 (default: "")
-
--page-filename <string> 分割的網頁名稱 (default:"")
-
--outline-filename <string> 生成的鏈接文件名稱 (default:"")
-
--process-nontext <int> 渲染圖行,文字除外 (default: 1)
-
--process-outline <int> 在html中顯示鏈接 (default: 1)
-
--printing <int> 支持打印 (default: 1)
-
--fallback <int> 在備用模式下輸出 (default: 0)
-
--embed-external-font <int> 嵌入局部匹配的外部字體 (default: 1)
-
--font-format <string> 嵌入的字體文件后綴 (ttf,otf,woff,svg) (default: "woff")
-
--decompose-ligature <int> 分解連字-> fi (default:0)
-
--auto-hint <int> 使用fontforge的autohint上的字體時不提示 (default: 0)
-
--external-hint-tool <string> 字體外部提示工具 (overrides --auto-hint) (default: "")
-
--stretch-narrow-glyph <int> 伸展狹窄的字形,而不是填充 (default: 0)
-
--squeeze-wide-glyph <int> 收縮較寬的字形,而不是截斷 (default: 1)
-
--override-fstype <int> clear the fstype bits in TTF/OTF fonts (default:0)
-
--process-type3 <int> convert Type 3 fonts for web (experimental) (default: 0)
-
--heps <fp> 合並文本的水平臨界值,單位:像素(default: 1)
-
--veps <fp> vertical threshold for merging text, in pixels (default: 1)
-
--space-threshold <fp> 斷字臨界值 (臨界值 * em) (default:0.125)
-
--font-size-multiplier <fp> 一個大於1的值增加渲染精度 (default: 4)
-
--space-as-offset <int> 把空格字符作為偏移量 (default: 0)
-
--tounicode <int> 如何處理ToUnicode的CMap (0=auto, 1=force,-1=ignore) (default: 0)
-
--optimize-text <int> 盡量減少用於文本的HTML元素的數目 (default: 0)
-
--bg-format <string> 指定背景圖像格式 (default: "png")
-
-o,--owner-password <string> 所有者密碼 (為了加密文件)
-
-u,--user-password <string> 用戶密碼 (為了加密文件)
-
--no-drm <int> 覆蓋文檔的 DRM 設置 (default: 0)
-
--clean-tmp <int> 轉換后刪除臨時文件 (default: 1)
-
--data-dir <string> 指定的數據目錄 (default: ".\share\pdf2htmlEX")
-
--debug <int> 打印調試信息 (default: 0)
-
-v,--version 打印版權和版本信息
-
-h,--help 打印使用幫助信息