Reproduced Java Open PDF Document online

Source: Internet
Author: User

Step one: (the tools involved)

Visit: http://www.zhuozhengsoft.com/dowm/, download pageoffice for Java from the official website.

Step Two: (Configuration Engineering)

1. Unpack the Pageoffice Development Kit, open the "Integrated Files" directory, and copy the Pageoffice4.4.0.2.jar from the "web-inf\lib" directory to your project's "Web-inf\lib" directory

2. Refer to the Web. xml file in the "Integrated Files" folder to configure the website. xml file in your project, or you can add the following configuration directly to your XML;

 1 <!--pageoffice Begin--2 <servlet> 3 <servlet-name>poserver</servlet-name> 4     <servlet-class>com.zhuozhengsoft.pageoffice.poserver.Server</servlet-class> 5 </servlet> 6 <servlet-mapping> 7 <servlet-name>poserver</servlet-name> 8 <url-pattern>/pose Rver.zz</url-pattern> 9 </servlet-mapping>10 <servlet-mapping>11 <servlet-name>pos Erver</servlet-name>12 <url-pattern>/sealsetup.exe</url-pattern>13 </servlet-mapping>1 4 <servlet-mapping>15 <servlet-name>poserver</servlet-name>16 <url-pattern>/po setup.exe</url-pattern>17 </servlet-mapping>18 <servlet-mapping>19 <servlet-name>p Oserver</servlet-name>20 <url-pattern>/pageoffice.js</url-pattern>21 </servlet-mapping&gt ; <servlet-mapping>23 <servlet-name>poserver</servlet-name>24 <url-pattern>/jquery.min.js</url-pa ttern>25 </servlet-mapping>26 <servlet-mapping>27 <servlet-name>poserver</servlet- name>28 <url-pattern>/pobstyle.css</url-pattern>29 </servlet-mapping>30 <!--PageO ffice end-->

3. On the page that displays the file list (for example: doclist.jsp), add a reference to the Pageoffice.js file and a hyperlink to open the file "open PDF Online":

<script type= "Text/javascript" src= "jquery.min.js" ></script> <script type= "Text/javascript" src= " Pageoffice.js "id=" Po_js_main "></script>......<a href=" javascript:POBrowser.openWindowModeless (/ Pdf.jsp ', ' width=1200px;height=800px; '); " > Open pdf</a> Online

4. Add the import package on the page that invokes the Pageoffice product (for example: pdf.jsp): com.zhuozhengsoft.pageoffice.*

5. Write the Pageoffice call code, open the file online (for example: Server D packing directory test.pdf):

Pdfctrl POCTRL1 = new Pdfctrl (Request);p Octrl1.setserverpage (Request.getcontextpath () + "/poserver.zz"); Poctrl1.webopen ("D:\\test.pdf");

6. Insert the following code where the Office interface needs to appear in the body of the HTML code:

<%=poctrl1.gethtmlcode ("PDFCtrl1")%>

7. Start the Run project, access the File list page (for example: doclist.jsp), click on the "Open PDF Online" hyperlink to view the online open edit save PDF file effect.

Reference Example:

1. Deployment Pageoffice Example: Copy the Samples4 folder in the Pageoffice development package to the Webapps directory of Tomcat, visit: http://localhost:8080/Samples4/index.html
2. Reference Basic Function Example: Two, 4, open PDF file online

Reproduced Java Open PDF Document online

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.