Skip to content

Instantly share code, notes, and snippets.

@JoelGeraci-Datalogics
JoelGeraci-Datalogics / LocateArticleThreads.java
Last active September 29, 2016 18:20
This sample locates article threads and outputs their coordinates to the console
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.pdf.document.PDFCatalogThreads;
import com.adobe.pdfjt.pdf.document.PDFDocument;
@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;
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / UnPortfolio.java
Created July 12, 2016 20:16
This sample removes the Collection dictionary from a PDF Portfolio making it a regular PDF file with attachments.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.core.types.ASName;
import com.adobe.pdfjt.pdf.document.PDFCatalog;
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.annotations;
import com.adobe.fontengine.font.Font;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.internal.io.LazyRandomAccessFileByteReader;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / DrawingPolygons.java
Created June 16, 2016 18:09
This sample draws two stars on a PDF Page using two different techniques.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.document;
import com.adobe.fontengine.font.Font;
import com.adobe.internal.io.ByteReader;
import com.adobe.internal.io.InputStreamByteReader;
import com.adobe.pdfjt.core.types.ASName;
@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 / 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;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / AddBookmarksBasedOnFontSize.java
Last active June 10, 2016 21:33
This sample extracts the text from a PDF file and uses a very simple heuristic to detect headings. When a heading is detected, it adds a bookmark. The heuristic was designed for this input file but can be easily modified and applied to any PDF file.
/*
* 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;