Development of the customer site encountered a demand, customer requests backstage upload PDF file, front desk can be in the form of book direct access.
The first thought is the use of JS solution, the user access to the front-end page, PHP will file path to JS, so that JS presents the effect of the book. Baidu on the Internet a circle also did not find ready-made plug-ins.
As a result of the flash done by someone, it is necessary to convert the PDF file uploaded by the client into a SWF file to be rendered by the flash provided by someone, and a SWF file will be generated on each page of the PDF in order to show the effect of flipping the book. At this time by someone to provide said, Swftools can complete this demand, so quickly Baidu.
Swftools This tool is not introduced, because I also only use a small part of the features, but also the Windows version of ...
Pdf2swf.exe is the tool used to convert PDFs to SWF. Command parameters are numerous and can be viewed "-help".
After research, it is found that only two parameters are required, "-O", "-help" explanation is "-O,--output file.swf Direct output to file.swf. If file.swf contains '% ' (file%.swf), then every page goes to a seperate file. "It is exactly what is needed to generate a SWF file for each of the PDF pages!!!
There is also a parameter, "-T".
The command line's specific command is "E:\swftools>pdf2swf.exe-o e:\test\d\%.swf-t d:\pdf\127.pdf", the result is smooth, but there is a new problem, Some of the content in the SWF is gone.
This kind of client must be squalling,-_-.
Baidu look for reasons, found posts are the same ... Self-Baidu "swftools Chinese problem", probably because the font is not supported, so when the conversion can not come out.
There is no way, only according to the people said to try it, sure enough still have effect, need to download a "xpdf-chinese-simplified", modify the file "ADD-TO-XPDFRC", download down the path is written Unix path, Need to be changed to Windows, there is a best addition to the phrase "displaycidfonttt adobe-gb1 E:\xpdf-chinese-simplified\gkai00mp.ttf".
This "Gkai00mp.ttf" also needs to download, probably should be a font library and so on.
After all, in the command line, the input command needs to add a parameter "-S", this parameter has many functions, self-"-help" check it.
Command-line command is now "E:\swftools>pdf2swf.exe-o e:\test\d\%.swf-t d:\pdf\127.pdf-s languagedir=e:\xpdf-chinese-simplified" , it probably means using this font library to parse the PDF file.
After running, the effect is very good, no problem, the single do not know the PDF file if there are other unrecognized fonts need to do ...
Summary: Swftools This tool is still relatively old, but it is open source, this time just use a part of the function. I don't know if there are any more useful conversion PDF tools.
Swftools tool to convert PDF files to swf files