CONTACT java pdf Suchen

+49 661 25100-0support & infohotline
Our Customer
KfW Bankengruppe
+49 661 25100-0support & infohotline
More Products
Our Partners
Oracle Gold Partner

Java and PDF

Java plays an important role in the PDF creation with webPDF:

  • The webPDF.portal is web service implemented in Java and running on a J2EE Apache TomCat Server in order to use installed there.
  • The webPDF.jclient is a platform-independant application based on Java.

Additonally, the converter web service of webPDF can be accessed by Java and is therefore integrable into other applications. Following you will see a sample code. The code is based on the assumption, that the webPDF server and the Java client are running on the same machine. The code is intended for demo purposes only and has to be adapted to local requirements.

package webpdfsample;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.namespace.QName;
import net.webpdf.oooconverter.wsclient.stub.*;
public class Main {
    public static void main(String[] args) {
        String serviceURL = "http://localhost:8080/webPDF/OOoConverter";
        String converterOptions = "pdf.restrictPermissions=true&pdf.
        OOoConverterService service = null;
        OOoConverter port = null;
        try {
            // get web service information
            URL url = new URL(serviceURL + "?wsdl");
            QName qname = new QName("",
            service = new OOoConverterService(url, qname);
            port = service.getOOoConverterPort();
        } catch (Exception ex) {
        // setup web service options
        OOoConverterOptions options = new OOoConverterOptions();
        // get a DataHandler to the source file
        javax.activation.DataHandler fileContent = new DataHandler(new
        FileDataSource(new File("webpdf.jpg")));
        javax.activation.DataHandler result = null;
        // start file conversion
        try {
            result = port.convert(options, fileContent);
        } catch (OOoConverterException_Exception ex) {
        if (result != null) {
            // stream file to output
            try {
                result.writeTo(new FileOutputStream(new File("webpdf.pdf")));
            } catch (Exception ex) {

Wenn Sie mehr über die Technik von webPDF erfahren möchten, klicken Sie hier. Sie können auf dieser Webseite kostenlos online PDF-Dateien erstellen und digital signieren, oder durch Download der Demo-Version die Funktionalität von webPDF auf Ihrem Rechner testen.