ceTe Software Help Library for Java August - 2020
DynamicPDF Generator for Java / Getting Started / Examples / Servlet Examples
In This Topic
    Servlet Examples
    In This Topic

    In the directory "DynamicPDF_ForJava10~/ceTeSoftware/examples/Generator/servlets" we have provided examples to show how DynamicPDF Generator for Java can be used in Servlets.

    Since loading of a servlet is a Servlet Engine or Java Application Server dependent process, we are providing you with a general installation procedure. Please check your Servlet Engine or Java Application Server manual if you need help in loading Servlets.

    Compile the HelloWorld.java file located under "DynamicPDF_ForJava10~/ceTeSoftware/examples/Generator/servlets" and place the HelloWorld.class file under the working directory of your Servlet Engine or Java Application Server. Please make respective changes into your web.xml to handle the servlet mapping. Calling this Servlet from a web browser will cause "HelloWorld.pdf" to be downloaded on the client machine.

    Similarly you can run other servlet java files to see their respective output. Brief descriptions of the examples are given below.

    Note: For examples which require a database connection to work, you will need to update the "conn.properties" file under the folder "properties". Also, some of the servlets require static resources which have been provided in the folders "data", "images", "text" located under  the folder "DynamicPDF_ForJava10~/ceTeSoftware/examples/Generator/"; these folders need to be copied to your web application folder.

    *HelloWorld.java
    This example shows how to generate a simple PDF document.

    *HelloWorld_Aes256BitEncrypted.java
    This example shows how to generate a PDF document with 256 bit encryption. Password is "password". This example requires Acrobat 9.0 or a compatible PDF viewer.

    *HelloWorld_RC4128BitEncrypted.java
    This example shows how to generate a PDF document with 128 bit encryption. User password is "user" and owner password is "owner". This example requires Acrobat 5.0 or a compatible PDF viewer.

    *HelloWorldLanguages.java
    This example displays the International font capabilities. This example requires the Acrobat Asian Font Pack. If the output looks corrupted or you get the "File not found" exception then please check that the "unicodeFont" variable is pointing to correct font and the font you provided has Asian language support.

    *AllPageElements.java
    This example shows how to use all the page elements that are available with Generator for Java. It also demonstrates how to build a custom page element.

    *TimeMachine.java
    This example shows how to generate a manuscript. This is a good example of how to use the overflow text methods to flow text to multiple pages.

    *TiffToPDF.java
    This example shows how to generate a PDF file from a Tiff Image. This is a good example of how a multipage tiff image can be converted into a PDF file.

    *USEnvelope.java
    This example shows how to address an envelope and use the Postnet barcode.

    *FormattedTextContinuation.java
    This example shows how to use the text overflow functionality.

    *SimpleXMLReport.java
    This example shows how to generate a simple report from XML data.

    *TableCalendar.java
    This example shows how to generate and use tables.

    *HtmlAreaTags.java
    This example shows how to use simple tags in HTML Area.

    *HtmlAreaTagsAndStyles
    This example shows how to use HTML tags with styles in HTML Area.

    *Watermark
    This example shows how to add watermark to the PDF.

    *PackagePdf.java
    This example shows how to create a package PDF.

    *SourceView .java
    This example reads and displays the source code of a java page, with color coding.

    *Charting.java
    This example shows how to generate a simple chart.

    *DigitalSignature.java
    This example shows how to Digitally sign a document.

    *HelloWorldTaggedPdf.java
    This example shows how to generate a PDF document with tagging.

    *ImageWithAltText.java
    This example shows how to add Alternate Text for images.

    *TaggedPdfWithStructureElements.java
    This example shows how to tag PDF documents that use lists and structured elements.

    *TimeMachineTaggedPdf.java
    This example shows how to tag PDF documents.

    The following examples need to be configured to connect to the Microsoft SQL Server "Northwind" database:


    *SimpleReport.java (MS SQL Server)
    This example shows how to generate a simple report.

    *ContactList.java  (Needs MS SQL Server)
    This example shows how to generate a report with grouping.

    *Invoice.java  (Needs MS SQL Server)
    This example shows how to generate invoices with barcodes.

    *TableReport.java  (Needs MS SQL Server)
    This example shows how to generate a report using the Table page element.

    *MailingLabels.java  (Needs MS SQL Server)
    This example shows how to create mailing labels from database data. It is coded for Avery label number 5160 but the  variables can easily be changed to accommodate many other label formats.