Skip to content

Instantly share code, notes, and snippets.

@JoelGeraci-Datalogics
JoelGeraci-Datalogics / AddAnnotationsToLayers.java
Created August 5, 2015 20:57
This sample shows how to add content and annotations to a layer on a PDF page. It also shows how to attach JavaScript to the PDF file at the document level.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.ByteWriter;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.core.types.ASString;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / SetLinkHitArea.java
Created August 18, 2015 23:39
This sample will find all the words on the first page of the document and add links over them. The links will use the quads of the word rather than the rectangular bounding box. This allows for the creation of links that are not parallel to the edges of the page.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.ByteWriter;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.core.fontset.PDFFontSet;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / ConvertPDFToSWF.java
Last active August 29, 2015 14:28
This Gist will convert each page of a PDF file to a SWF file.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import java.io.InputStream;
import java.net.URL;
import pdfjt.util.SampleFileServices;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / FillFormsFromSQL.java
Created September 1, 2015 23:30
This sample will populate a PDF form based on data in a MySQL database. One PDF per record will be created.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.forms;
import java.io.InputStream;
import java.net.URL;
import java.sql.DriverManager;
import java.sql.Connection;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / HelloWorld.java
Created September 2, 2015 21:22
This sample allows users to create a new blank PDF and place the text "Hello, World!" onto it. This PDF is saved and written out to a file called HelloWorld.pdf.
/*
* Copyright 2015 Datalogics Inc.
*/
package pdfjt.cookbook.document;
import pdfjt.util.SampleFileServices;
import com.adobe.pdfjt.pdf.document.PDFDocument;
import com.adobe.pdfjt.pdf.document.PDFOpenOptions;
import com.datalogics.pdf.document.DocumentHelper;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / FillFormsWithImagesFromSQL.java
Last active September 9, 2015 17:25
This sample will populate a PDF form based on data in a MySQL database including image data. One PDF per record will be created. There are 9 records.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.forms;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.net.URL;
import java.sql.DriverManager;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / GenerateLegalAttestation.java
Last active June 10, 2016 22:06
This sample will scrub the document for PDF features that can make the rendered appearance of a PDF document vary. It will then generate and add the LegalAttestation object to the document catalog.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / WhiteFang.java
Last active July 28, 2016 08:05
Converts a TXT file to PDF
/*
* Copyright 2015 Datalogics Inc.
*/
package pdfjt.cookbook.document;
import com.adobe.pdfjt.pdf.document.PDFDocument;
import com.adobe.pdfjt.pdf.document.PDFOpenOptions;
import com.datalogics.pdf.document.DocumentHelper;
import com.datalogics.pdf.layout.LayoutEngine;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / ReadBarcodeFromPDF.java
Last active June 10, 2016 22:02
This sample finds images in a PDF file and decodes any barcodes that are found.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.forms;
import com.adobe.internal.io.ByteArrayByteWriter;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.core.types.ASName;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / ReadBarcodeFieldFromPDF.java
Last active June 10, 2016 22:00
This sample finds fields in a PDF file and identifies any barcode fields then prints it's value to System.out.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.forms;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.pdf.document.PDFDocument;
import com.adobe.pdfjt.pdf.document.PDFOpenOptions;