Directory
Baidu Library solution (I)-Overall Thinking
Baidu Library solution (2) -- use Jacob to call MS Office to convert the document to PDF
Baidu Library solution (3) -- use JCom to call MS Office or Acrobat API to convert the document to PDF
Similar to Baidu Library solution (4) -- use JODConverter to call OpenOffice.org to convert the document to PDF
Baidu Library solution (5)-use SWFTools to Convert PDF files to SWF
Baidu Library solution (6)-use FlexPaper to display Flash (SWF)
The unzip 2swf tool in the SWFTools Toolkit can be used to convert PDF files into SWF files. Use the following command to convert a PDF file to a single-page swf file.
Ipv2swfPdfPath-O SwfPath-T 9-f.
Pdf2swf is the absolute path of the pdf2swf BINARY command, pdfpath is the absolute path of the PDF file to be converted, and swfPath is the path of the swf file after conversion; -T 9 is used to set the conversion swf version to 9. This setting is because some versions of swf files cannot be normally displayed using flexpaper.-f inserts a frame into each page of the conversion document, improve the stability of the converted documents.
Each Java application has a Runtime class instance, enabling the application to be connected to the running environment. Applications cannot create their own Runtime instances. You can use the getRuntime method of the Runtime class to obtain the current Runtime. After obtaining the Runtime class instance, you can call the exec method of the class to create a new process to execute the specified string command. Therefore, the exec method can be used to call the aforementioned unzip 2swf command to Convert PDF files to SWF files.
The algorithm flow for converting a PDF file to SWF format using SWFTools is shown in Figure 5-1:
Step 1: Create the escape 2swf conversion command string.
Step 2: Obtain the Runtime of the current Runtime. Call the set conversion command in step 1 to perform conversion.
Figure 5-1 use SWFTools to convert a PDF document to a SWF Process
The implementation code is as follows:
View Code
Note:
Source code: DocConverter
Reprinted Description: This article is the author's original. When reposted, please indicate the source of the article: Sean also has a dream blog Park. Please respect the author's Labor achievements. Thank you!