Skip to content

Instantly share code, notes, and snippets.

View JoelGeraci's full-sized avatar

Joel Geraci JoelGeraci

View GitHub Profile
@JoelGeraci
JoelGeraci / acrojs_dependentList.js
Last active March 16, 2023 09:02
Acrobat JavaScript: Change list values based on another list
/*
LICENSE:
acrojs_dependentList.js by Joel Geraci is licensed under a Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
Setup:
@JoelGeraci
JoelGeraci / acrojs_fieldPrompt.js
Last active November 29, 2016 02:21
Acrobat JavaScript: This script will display the text of the field tooltip when the value is empty prompting the user to enter data
/*
This script will display the text of the field tooltip when the value is empty prompting the user to enter data
Add this code to the custom format script for text fields.
*/
if (event.target.value == "") {
event.value = event.target.userName;
}
@JoelGeraci
JoelGeraci / PPDF_fixFields.js
Created December 4, 2016 20:05
Adds a menu item to repair form field appearances in Adobe Acrobat and Reader
/*
Version 1.4 (Updated for Acrobat DC)
Folder Level Javascript Created by Joel Geraci - joel@practicalpdf.com
*/
if (app.viewerType != "Reader" || app.viewerVersion >= 11) {
app.addMenuItem({
cName: "PPDF_fixFields",
cUser: 'Fix Field Appearances',
cParent: 'Edit',
cExec: "fixFields()",
var viewerOptions = {
embedMode: "FULL_WINDOW",
defaultViewMode: "FIT_PAGE",
showDownloadPDF: false,
showPrintPDF: false,
showLeftHandPanel: true,
showAnnotationTools: false,
enableSearchAPIs: true
};
function executeSearch() {
var previewFilePromise = window.adobeFilePreview;
previewFilePromise.then(adobeViewer => {
adobeViewer.getAPIs().then(apis => {
if ($("#search-term").val().length == 0) {
$("#search-term").val($("#search-term").attr("placeholder"));
}
apis.search($("#search-term").val()).then(searchObject => {
window.searchObject = searchObject;
searchObject.onResultsUpdate(onResultsUpdate)
@JoelGeraci
JoelGeraci / PPDF_Extract_Preprocessors.java
Last active March 26, 2024 19:04
This Gist will determine if a PDF file will produce usable results from the Adobe Extract API
/* Adobe Extract API Preprocessors by practicalPDF Inc. © 2024 by Joel Geraci is licensed under CC BY-SA 4.0 */
package com.practicalpdf.ExtractPreProcessors;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collection;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.cos.COSName;