• Common Slider

    Common Slider

    Qoppa Software offers a suite of carefully designed and developed products to cover every aspect of PDF processes and document workflows.

jPDFWeb Developer Guide

jPDFWeb Developer Guide

Contents

Introduction
Getting Started
Converting To SVG
Getting Basic Document Information
Web Viewer Installation and Configuration
Distribution and Jar files

Javadoc API
Source Code Samples

Introduction

jPDFWeb is a Java library to convert PDF documents to HTML5, supported by all modern browsers.  Using jPDFWeb, you can serve PDF content to your end users directly in the browser, without a need for any plugins or any other software, while keeping control of your documents.  jPDFWeb is 100% Java, so it can run on any J2EE server or on any platform that supports Java.

To achieve visual fidelity, jPDFWeb converts PDF content to SVG, which is supported by HTML5 and therefore can be inserted directly into HTML5 pages.  jPDFWeb is built using Qoppa’s PDF technology, developed and improved for more than 10 years, and therefore delivers a robust and mature solution.

Getting Started

The starting point for using jPDFWeb is the com.qoppa.pdfWeb.PDFWeb class. This class is used to load and convert PDF documents to HTML5 / SVG.

The class provides three constructors to load PDF files from the file system, a URL or an InputStream. All constructors take an additional parameter, an object that implements IPasswordHandler, that will be queried if the PDF file requires a password to open (called Open or User password). For PDF files that are not currently encrypted, this second parameter can be null:

PDFWeb pdfWeb = new PDFWeb(new URL("http://www.mysite.com/content.pdf"), null);

Converting to SVG

Once a PDF document has been loaded by instantiating the PDFWeb class, individual pages, or the entire document, can be exported as SVG:

// Export the first page as SVG to a file
pdfWeb.savePageAsSVG(0, "c:<b>\\</b>somefile.svg");
// Export a page to SVG to a Writer (i.e. from a servlet to the browser)
pdfWeb.savePageAsSVG(pageIndex, respWriter);

jPDFWeb also provides functions to export pages as images for use as page thumbnails (or other uses):

// Export the document as SVG
pdfWeb.savePageImage(0, 150, IMGFMT_PNG, "c:\\page1.png");

Getting Information about the PDF Document

To get basic information about the loaded PDF document, you need to get the DocumentInfo class accessible through PDFWeb.getDocumentInfo. From this class, you can get information about the document such as title, author, subject, keywords, etc…

System.out.println(pdfWeb.getDocumentInfo().getTitle());
System.out.println(pdfWeb.getDocumentInfo().getAuthor());
System.out.println(pdfWeb.getDocumentInfo().getKeywords());

There is a separate method to retrieve the count of pages in the PDF document:

int numPages = &nbsp; pdfWeb.getPageCount();

Web Viewer Installation and Configuration

Our knowledge base details how to configure an application server to create a zero-footprint HTML5 PDF Viewer by using jPDFWeb to convert PDF documents to SVG, and serving HTML5 to the client.

Distribution and JAR Files

Required and optional jar files for jPDFWeb can be found on the jPDFWeb Download page.

Javadoc API
Source Code Samples