Skip to content

Instantly share code, notes, and snippets.

@JoelGeraci-Datalogics
JoelGeraci-Datalogics / SplitDocumentBasedOnNumberOfPages.java
Last active June 10, 2016 21:27
"Splits" a document by creating a new set of PDF files by extracting pages from the source file based on a maximum number of pages in the new files. The original file is unmodified.
/*
* 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.pdf.document.PDFDocument;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / SplitDocumentBasedOnFileSize.java
Last active June 10, 2016 21:29
Splits a document based on number of pages
/*
* 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.pdf.document.PDFDocument;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / FindAndRemoveWatermarks.java
Last active June 10, 2016 21:30
Finds and removes Watermarks and Backgrounds from all pages in a document
/*
* 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.cos.CosDictionary;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / SplitDocumentBasedOnBookmarks.java
Last active June 10, 2016 21:31
Splits a PDF document based on bookmark destinations
/*
* 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.pdf.document.PDFDocument;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / PrintPDF.cs
Created November 9, 2015 19:06
Demonstrates the use of the Adobe PDF Library with the Datalogics Extensions to print a PDF file from the command line without user dialogs.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Datalogics.PDFL;
/*
*
* A sample which demonstrates the use of the DLE API to print a PDF file
* without any user dialogs.
@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;
@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 / 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 / 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 / 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;