Similar to Baidu Library solution (5) -- use SWFTools to Convert PDF files to SWF overall idea use Jacob to call MS Office to convert documents to PDF use JCom to call MS Office or Acrobat API to convert documents

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.