linux中doc/ppt檔案轉換pdf檔案方法

來源:互聯網
上載者:User

doc ppt轉pdf在linux還是沒有完美解決,不管是openoffice,還是libreoffice。
開啟doc,ppt文檔可能會出現布局錯亂的情況。libreoffice還不是很完美,建議裝穩定最新版,4.3.3
裝了一下wps for linux,開啟doc,ppt根win下面一樣,但是wps並沒有提供命令或者轉換介面。
所以想完美解決doc,ppt轉pdf還是要在windows下面做。

一,安裝libreoffice,imagemagick

# yum install ImageMagick libreoffice 
libreoffice可以實現doc,ppt轉pdf
imagemagick可以實現pdf轉圖片

二,libreoffice添加字型

libreoffice內建的字型很少,如果libreoffice找到字型,就會預設使用宋體,五號字
# mount /dev/sda1 /mnt/win7/ 
# cp -r /mnt/win7/Windows/Fonts/ /home/tank/.config/libreoffice/4/user/fonts 
重新開啟doc,ppt文檔,你會發現字型多出來很多。
libreoffice 添加字型
libreoffice 添加字型

三,doc,ppt轉pdf

1,直接利用libreoffice

 代碼如下 複製代碼

$ export DISPLAY=:0.0 && libreoffice --headless --invisible --convert-to pdf 123.ppt 
convert /home/tank/download/myppt/123.ppt -> /home/tank/download/myppt/123.pdf using impress_pdf_Export 
Overwriting: /home/tank/download/myppt/123.pdf 

2,pdf轉圖片

 代碼如下 複製代碼


$ convert -verbose -density 150 -trim 123.pdf -quality 70 -sharpen 0x1.0 123.jpg 
"gs" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r150x150" "-sOutputFile=/tmp/magick-XXSi41Xk" "-f/tmp/magick-XXkgR3hF" "-f/tmp/magick-XXQJ4sEZ" 
/tmp/magick-XXSi41Xk[0] PNM 1240x1754 1240x1754+0+0 8-bit DirectClass 18.67mb 
/tmp/magick-XXSi41Xk[1] PNM 1240x1754 1240x1754+0+0 8-bit DirectClass 18.67mb 
/tmp/magick-XXSi41Xk[2] PNM 1240x1754 1240x1754+0+0 8-bit DirectClass 18.67mb 
123.pdf[0] PDF 1240x1754 1240x1754+0+0 16-bit DirectClass 18.67mb 
123.pdf[0] PDF 1240x1754 1240x1754+0+0 16-bit DirectClass 18.67mb 
123.pdf[0] PDF 1240x1754 1240x1754+0+0 16-bit DirectClass 18.67mb 
123.pdf=>123-0.jpg[0] PDF 1240x1754=>546x1417 1240x1754+199+168 16-bit DirectClass 140kb 
123.pdf=>123-1.jpg[1] PDF 1240x1754=>623x1417 1240x1754+199+168 16-bit DirectClass 108kb 
123.pdf=>123-2.jpg[2] PDF 1240x1754=>653x703 1240x1754+199+168 16-bit DirectClass 68kb 

3,利用unoconv,實現doc,ppt轉pdf

 代碼如下 複製代碼


# yum install http://pkgs.repoforge.org/unoconv/unoconv-0.5-1.el6.rf.noarch.rpm   
 
# unoconv -f pdf 123.ppt     //將123.ppt轉成pdf 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.