In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to achieve php online demonstration function, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Php online demonstration function to achieve the method: 1, other formats of documents into PDF format documents through OpenOffice; 2, through swftools to convert PDF format documents into swf format documents; 3, through flexpaper display swf format documents, so as to achieve preview of documents in a variety of formats.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
How to achieve php online demonstration function?
Realization of php online Preview function under Windows
Recently used the document online preview function, did not touch before, everything starts from scratch, the whole period of time finally realized, now the method to share with you!
I. main train of thought
First of all, other formats of documents (office documents, txt, pictures, etc.) are converted into PDF format documents through OpenOffice, then PDF format documents are converted into swf format documents through swftools (http://www.swftools.org/), and finally swf format documents are displayed through flexpaper, thus realizing the preview of documents in a variety of formats.
The tools used are downloaded from the Internet and are easy to find.
Second, the process of realization
1. Other documents are converted to PDF
Start OpenOffice with the command:
Run-> cmd, and enter the following command
Cd / d E:/openoffice/program & soffice-headless-accept= "socket,host=127.0.0.1,port=8100;urp;"-nofirststartwizard
Or enter the program directory in cmd and type
Soffice-headless-accept= "socket,host=127.0.0.1,port=8100;urp;"-nofirststartwizard
Php implementation code:
Set_time_limit (0); function MakePropertyValue ($name,$value,$osm) {$oStruct = $osm- > Bridge_GetStruct ("com.sun.star.beans.PropertyValue"); $oStruct- > Name = $name; $oStruct- > Value = $value Return $oStruct;} function word2pdf ($doc_url, $output_url) {$osm = new COM ("com.sun.star.ServiceManager") or die ("Please be sure that OpenOffice.org is installed.n") $args = array (MakePropertyValue ("Hidden", true,$osm)); $oDesktop = $osm- > createInstance ("com.sun.star.frame.Desktop"); $oWriterDoc = $oDesktop- > loadComponentFromURL ($doc_url, "_ blank", 0, $args) $export_args = array (MakePropertyValue ("FilterName", "writer_pdf_Export", $osm)); $oWriterDoc- > storeToURL ($output_url,$export_args); $oWriterDoc- > close (true) } $doc_file = 'DMAG WAMP doc_file www doc_file file:///"; $DGV =' DGV 'onlineread Grey Universe docfile.docked; $DGV =' DMAX onlinereadCharger WAMP * * $doc_file; $output_file = "file:///". $output_file; word2pdf ($doc_file,$output_file)
2.PDF is converted to swf and displays
Php implementation code:
Var path= "/"; / / call the variable of php. If it cannot be implemented, consider writing / / var path= "/" in the next sentence. Var fp = new FlexPaperViewer ('_ _ PUBLIC__/FlexPaper/FlexPaperFlash/FlexPaperViewer', 'viewerPlaceHolder', {config: {/ / configuration parameters You can modify it to the desired SwfFile: escape (path), Scale: 1, ZoomTransition: 'easeOut', ZoomTime: 0.5, ZoomInterval: 0.2, FitPageOnLoad: false FitWidthOnLoad: false, PrintEnabled: true, FullScreenAsMaxWindow: false, ProgressiveLoading: false, MinZoomSize: 0.2, MaxZoomSize: 5, SearchMatchAll: false InitViewMode: 'Portrait', ViewModeToolsVisible: true, ZoomToolsVisible: true, NavToolsVisible: true, CursorToolsVisible: true, SearchToolsVisible: true LocaleChain: 'en_US'}})
3. Preparation before operation
You need to make the following settings first, otherwise there may be errors in the process of running!
Control Panel-Administrative tools-component Services-computer-my computer-DOCM configuration, find the OpenOffice Service Manager (Ver 1.0) right-click properties, and configure as shown in the following figure:
Find OpenOffice Service Manager (Ver 1.0) as shown in the following figure:
Select Security in the pop-up box and edit Startup and Activation permissions and access permissions respectively:
Click add in the 'launch and activate permissions' pop-up box and enter Everyone:
Set the permissions for Everyone:
Click add in the pop-up box of 'access permissions' and enter Everyone:
Set Everyone permissions:
Select 'identity' in the properties dialog box and select 'Interactive user':
If you encounter a failure to instantiate the COM class, open the php configuration file, remove the semicolon before com.allow_dcom=true, and add extension=php_com_dotnet.dll, because php5.4 will not embed com later.
Don't forget to restart the service after setting up!
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.