PHP implementation Imitation Baidu Library, bean Ding Online document effect (word,excel,ppt to Flash), _php tutorial

Source: Internet
Author: User
Tags getting started with php map class mysql create

PHP to implement imitation Baidu Library, bean Ding Online document effect (word,excel,ppt to Flash),


This article describes the PHP implementation of imitation Baidu Library, bean Ding online document effect. Share to everyone for your reference, as follows:

Because the project to achieve similar to the function of Baidu Library, I am a person to do the project, so I think to find free ready to use. All found on the internet is the same. As follows:

Flash paper supports Office documents (. doc,.xls,.ppt) to convert directly to PDF or SWF, which is fast and works better. Unfortunately, Flash Paper V2.2 no longer updated. After installing Flash paper, you can call FlashPrinter.exe directly with the command to implement batch conversions.

For example: C:\FlashPaper2.2\FlashPrinter.exe C:\Flex Technical Introduction. Ppt-o C:\Flex Technical Brief. swf

Download a flashpaper, after installation, the Control Panel printer there will appear a virtual printer, this means that the installation was successful, Win7 I tried 32-bit and 64-bit is not installed.

Try the above command at the command line, and the path is adjusted according to itself. After the execution, the success of the instructions can be used.

The next step is to use PHP, which uses exec, or system, to execute the cmd command, such as:
Copy the Code code as follows: Exec ("C:\FlashPaper2.2\FlashPrinter.exe C:\Flex Technical Introduction. Ppt-o C:\Flex Technical Introduction. swf");

To do this before you configure the following php.ini to set the safe mode to OFF (Safe_mode = off), or to open the line, in Safe_mode_exec_dir = set allow EXE path, set to Flashpaer path.

Test it and execute it successfully!

These can be found on the Internet, because I use office2007 word suffix. docx, the conversion of the time of failure, has been on the internet can not find the reason, inadvertently, I have to convert the A.docx renamed to A.doc conversion success, so I also want to not understand, Because directly under CMD, converting. docx is possible. In the same vein, to turn 2007 Ppt,excel is to remove the suffix that x can be converted.

Add:

Recently, a project to use similar docin document conversion and reading functions, so began to find relevant information, finally summed up 2 solutions, the following two methods to explore the respective implementation.

The first kind: through the flash PAPER to convert the doc document directly generated SWF, this is very simple, download a flash PAPER installation can be called, we are in the program with CMD call, the command is called: C:\Program Files\macromedia\ Flashpaper 2\flashprinter.exe Xxx.ppt-o xxx.swf, but after I test, this thing has a great flaw, can not be combined with a few together, that is, can only convert a document at the same time, I do not know there is no other way to solve the problem, If you have a solution, please also tell me, FLASH paper conversion principle is this: to create a virtual printer, open the document, virtual printing, get the printed content directly generated SWF, so the conversion of a document requires a virtual printer run ~ ~ ~ The middle will pop up the window to print and open the document. This program does not meet my requirements, direct pass.

The second: The use of open source software OpenOffice to convert the document into a PDF, through the Swftools to convert the PDF to SWF, which to use more than the number of things, the following one by one. This scheme can be run under the system of Microsoft, also can run under Linux, I run under the CENTOS5.5 character interface, the following is the process:

Install the CENTOS5.5 system first, the installation process is no longer wordy, I am the most simple installation

Once the system is installed, download the required packages: the packages we use are

There is also a OpenOffice plugin that all of our applications are based on: Jodconverter

Download address is: http://sourceforge.net/projects/jodconverter/files/

Okay, the package is ready, and the following is on. ⌒_⌒

Install the JDK & Tomcat first, the installation process will not be wordy, not Google under

Next, install OpenOffice,

So OpenOffice installed, if your system does not have Chinese fonts, the Chinese fonts installed, otherwise the PDF will be garbled

After installing the OpenOffice, it is easier to install the Swftools,swftools installation.

To this, all the installed software has been installed, as I am now using

Start with the services you need to start up,

Start the OpenOffice first, we start as a service, start the command as follows
Copy the Code code as follows: #/opt/openoffice.org3/program/soffice-headless-accept= "SOCKET,HOST=127.0.0.1,PORT=8100;URP;" -nofirststartwizard &

Then the Tomcat started, the Jodconverter as a web App conversion service, so first the disaster down Jodconverter-webapp-2.2.2.zip decompression, the jodconverter-webapp-2.2.2. The war is placed in the Tomcat root directory, and after Tomcat is run, the app folder is automatically generated and, for simplicity of writing, we renamed converter, assuming your server IP: 192.168.1.123www.linghan56.cn,tomcat port is 8080, browser input: http://192.168.1.123:8080/converter/, see the conversion program is running normally, start normal, Our work is finished more than half. The main work has been done, now the rest is how to apply, I am using PHP calls the program of conversion, the user uploads files through PHP,

Determine the file type, if it is jpg,gif,png,pdf, etc. using Swftools can be directly converted files, directly converted, otherwise, through the http://192.168.1.123:8080/converter/to convert the file to PDF, Using Swftools to convert PDF to SWF, it is worth noting that the PDF to SWF, note that the version into 9, if converted to 9 below the version, AS3 operation will be very cumbersome, swftools conversion command is as follows:
Copy the Code code as follows: #/usr/local/swftools/bin/pdf2swf-t 9 xxx.pdf xxx.swf

Where-T is the version information that can be queried by #/usr/local/swftools/bin/pdf2swf-help

Now the whole process is finished 3/4, the rest is to write a thing with AS3, operation PDF generated SWF, generated SWF file format is this, each page of the document will generate a MovieClip, the specific code I can not post, this is not difficult to believe.

Originally wanted to put an online demo, but I this VPS configuration is too low, 512M of memory, can not add their own swap, ran Php+mysql, ran this, the application requires memory and CPU is pretty high.

Comparison of the two methods, the first kind of conversion should be better, and the format of support more, in theory, as long as the things can be printed, can be converted, just can't concurrency, so the meaning is not big, if you can use this principle, write a conversion server, to solve the concurrency problem, the first should be the most appropriate.

The second type can only convert OpenOffice supported formats, and the server requirements are very high. Do not know Docin and Baidu document is what kind of solution

More readers interested in PHP related content can view this site topic: "PHP Operations Office Document Tips summary (including word,excel,access,ppt)", "PHP date and Time usage summary", "PHP Object-oriented Programming tutorial", "PHP string (string) Usage summary, "Getting Started with Php+mysql database operation" and "PHP common database Operation Skills Summary"

I hope this article is helpful to you in PHP programming.

Articles you may be interested in:

    • PHP Check page is included in Baidu
    • PHP Gets the website Baidu Snapshot Date method
    • PHP to get Baidu included, Baidu hot word and Baidu Snapshot method
    • PHP calculates the distance between two GPS coordinates of Baidu map
    • PHP generated Baidu sitemap Site Map class function instance
    • thinkphp call Baidu Translation class realization online translator
    • PHP uses Baidu ping Service Code instance
    • PHP methods for creating PowerPoint2007 documents
    • Principles and examples for exporting Word documents using PHP
    • Custom PHP Class (Find/Modify) XML documents
    • Implementation code for generating Flash animations in PHP
    • Flash+php+mysql Create a simple message this tutorial
    • Dynamically create Flash animations with PHP

http://www.bkjia.com/PHPjc/1108614.html www.bkjia.com true http://www.bkjia.com/PHPjc/1108614.html techarticle PHP to implement the Imitation Baidu Library, bean Ding Online document effect (word,excel,ppt to Flash), this example tells the PHP implementation of imitation Baidu Library, bean Ding online document effect. Share to everyone for your reference, ...

  • Related Article

    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.