Home  >  Article  >  Backend Development  >  How to convert php pdf to swf

How to convert php pdf to swf

藏色散人
藏色散人Original
2020-11-05 14:09:262513browse

php How to convert pdf to swf: first install swftools; then download the Chinese support and font library; then upload the pdf file to the server in the project; and finally execute the file conversion code.

How to convert php pdf to swf

Recommended: "PHP Video Tutorial"

PHP converts pdf files into swf files

When using PHP to develop a dermatology website, the function of online browsing of pdf files is used. The js player plug-in needs to convert the pdf file into a swf file at the same time to achieve the effect.

First of all, you need to install the pdf to swf conversion tool on the linux server

Install swftools

Chinese support installation:

mkdir –p /usr/share/xpdf
cd /usr/share/xpdf/

Download Chinese support and font library

wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified.tar.gz
wget http://www.nginxs.com/download/font.zip
tar zxvf xpdf-chinese-simplified.tar.gz
unzip font.zip
mv Gbsn00lp.ttf gkai00mp.ttf xpdf-chinese-simplified/CMap/ cd /usr/share/xpdf/xpdf-chinese-simplified

Edit and add new fonts

vim add-to-xpdfrc

The content is as follows:

cidToUnicodeAdobe-GB1/usr/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode
unicodeMapISO-2022-CN/usr/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap
unicodeMapEUC-CN/usr/share/xpdf/chinese-simplified/EUC-CN.unicodeMap
unicodeMapGBK/usr/share/xpdf/chinese-simplified/GBK.unicodeMap
cMapDirAdobe-GB1/usr/share/xpdf/chinese-simplified/CMap toUnicodeDir/usr/share/xpdf/chinese-simplified/CMap
displayCIDFontTT Adobe-GB1 /usr/share/xpdf/chinese-simplified/CMap/gkai00mp.ttf

Exit after saving

SwfTool installation:

cd /usr/local/wenku
wget http://www.swftools.org/swftools-0.9.1.tar.gz
tar zxvf swftools-0.9.1.tar.gz
cd swftools-0.9.1
./configure 6)make
make install

Test whether it is available

pdf2swf -o /usr/output.swf -T -z -t -f /usr/test1.pdf -s languagedir=/usr/local/share/xpdf/chinese-simplified -s flashversion=9

Then how to apply it to the project is as follows

In the method of uploading pdf files to the server in the project

Below It is the code to perform file conversion, $path1 is the saved address of the converted swf file, $path is the pdf file path

system("pdf2swf -o $path1 -T -z -t -f $path -s languagedir=/usr/share/xpdf/xpdf-chinese-simplified -s flashversion=9 -s poly2bitmap",$out);

It will be successful if the above is completed

The above is the detailed content of How to convert php pdf to swf. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn