Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / FindAndRemoveWatermarks.java
Last active July 27, 2021 17:08
Finds and removes Watermarks and Backgrounds from all pages in a PDF 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 / InsertRichMediaAnnotation_U3D.java
Created January 25, 2016 18:28
Inserts a 3D model in a PDF page using the Rich Media Annotation.
/*
* Copyright Datalogics, Inc. 2016
*/
package pdfjt.cookbook.annotations.richmedia;
import com.adobe.internal.io.LazyRandomAccessFileByteReader;
import com.adobe.pdfjt.core.types.ASName;
import com.adobe.pdfjt.core.types.ASRectangle;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / InsertRichMediaAnnotation_U3D_Advanced.java
Last active August 9, 2022 19:46
Creates a new PDF with a 3D Annotation, in this sample a U3D file is used.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.annotations.richmedia;
import com.adobe.internal.io.LazyRandomAccessFileByteReader;
import com.adobe.pdfjt.core.cos.CosCloneMgr;
import com.adobe.pdfjt.core.cos.CosObject;
@JoelGeraci-Datalogics
JoelGeraci-Datalogics / InsertRichMediaAnnotation_Video.java
Last active March 2, 2016 15:40
Creates a new PDF with a 3D Annotation on the first page
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.annotations.richmedia;
import com.adobe.internal.io.LazyRandomAccessFileByteReader;
import com.adobe.pdfjt.core.types.ASName;
import com.adobe.pdfjt.core.types.ASRectangle;
import com.adobe.pdfjt.core.types.ASString;