This tutorial shows you how to work with the JavaScript features in Acrobat 9. See what the all-new Acrobat DC can do for you. Scope: Acrobat 9. Redaction, or selectively removing content from a PDF, is an important part of distributing PDFs that contain sensitive information.
In Acrobat, redaction was added as a standard tool. With the release of Acrobat 9, redaction is available for automation in JavaScript. This means you can create a one-click or batch-redaction solution.
But, there is some work that needs to be done to set this up. These steps do not need to how to redact in adobe acrobat standard dc free download done all at once. For example, the document could be marked for redaction and then sent to other users for review. The actual redaction could be done after the review is complete.
The document could even be comment-enabled so the reviewers can use Adobe Reader. The Acrobat user interface provides both a manual process and a search process for marking and redacting content. Automating redaction with Acrobat JavaScript extends these features by adding the ability to create custom redaction scripts and to mix redaction in with scripts that do other tasks. Automation saves time and provides greater flexibility in how redaction can be applied to a document.
Because redaction is a major document manipulation, it cannot be done in Reader, and the JavaScript function requires a privileged or trusted context. So this is very much an application-level automation operation. It cannot be done from a document script. The script can be run from a simple copy-and-paste into the JavaScript Console.
It can be placed in a Batch Process to operate on multiple documents. Or it can be run from an Acrobat toolbar button created in how to redact in adobe acrobat standard dc free download Folder Level Script for a one-click solution. For demonstration purposes, all the examples in this article will be run from the Acrobat JavaScript Consolewhich is a privileged context and also very handy for running quick copy-and-paste automation scripts. Download this file and save it to a local folder on your system:.
This file is a list of W4 forms for new employees. Because the file contains sensitive information, parts of the W4 need to be redacted before being distributed. For this purpose, two redaction schemes are needed. In general, there are two different approaches to identifying a particular piece of page content- absolute page position and searching the text. The input to the search is a regular expression. This script tests single words pulled from the page content, but could be modified to build up more complex strings for testing.
However, words are not necessarily pulled from the page in the order they appear, how to redact in adobe acrobat standard dc free download you have to be careful.
The W4 form has a very consistent geometry, so we can assume a specific piece of content is always at the same location. All we have to do is find the locations of the content of interest. A quad is an array of eight numbers. Each pair of numbers is a point, so a quad is four points.
Using a quad instead of a rectangle structure handles the situation where text is rotated. So, our task is to find the coordinates of the space we want to redact, and then convert it to a quad. We can do this by manually placing another annotation type over the area.
The rectangle annot is the best choice Figure 1. Then, run the following code in how to redact in adobe acrobat standard dc free download window to print out the quad for that location:. Now copy the quad into the code that will become the redaction script. Move and resize the annotation, then re-run the code and copy the new quad into how to redact in adobe acrobat standard dc free download code. Repeat this operation until all redaction areas have been covered. Notice that the quad numbers in Figure 1 are all rounded.
I use the Math. Marking an area for redaction is done with the Redact Annotation. This is a new annotation type added in Acrobat 9. Its only purpose is to mark page areas for redaction. From JavaScript, this annotation is added with the following line of code:. At a minimum, the only parameters that need to be specified are the annotation typethe page number and the quads array. The overlay text is used by the redaction function to replace the content removed from the page.
In our example, there are two different types of redaction. The best way to approach this situation is to build a function that works for both. How to redact in adobe acrobat standard dc free download only difference between the two redactions is the areas they affect, so our input to the function should be a list of the areas to redact. This code walks through the document pages and adds Redact Annotations. One annotation is added for each quad in the list.
The second parameter bKeepMarks instructs the function to keep the Redact Annotations; otherwise they are deleted. If the third parameter bShowConfirmation is set to true, then a popup dialog is displayed when redaction is complete. The fourth parameter cProgText is text displayed on the progress bar as the redaction is taking place. Redaction can take a very long time.
Now we have all the parts needed to make this work. We have the quads for all the areas that need redacting, a function for applying the Redact Annotation, and a function for applying redactions.
The third part is where the redaction is really done. It includes sections of code for applying both redaction schemes outlined earlier. Each section of code is identical except for the list of quads passed into the AddMyRedacts function. You can modify how the scripts work by changing this list. To use this code, copy it to the Acrobat JavaScript Console.
Select and run Parts 1 and 2. Then select the code for the scheme that will be used on the current document and run it. Run only one scheme on one document. A more interesting and useful way to run an automation script is with an Acrobat toolbar button or menu item. However, using one of these options requires that the code be enclosed in a trusted function.
I have a simple request to identify the javascript action to delete any pages in a given pdf that have a particular text string how to redact in adobe acrobat standard dc free download them not redaction just deletion. I would say it needs to. Can you help me? I get the error SyntaxError: missing ; before statement 1:Console:Exec undefined.
Try Acrobat DC. Learn how to edit PDF. Get started. Remove sensitive information using redaction tools in Acrobat 9. Applying password security to PDF files using Acrobat 9. Rearrange PDF pages. Create PDF online. Convert Word to PDF online. Convert Excel to PDF online. Compress PDF online.
Sign Microsoft Word documents. Create electronic signatures. Create digital signatures. Create PDFs. Edit PDFs. Export PDFs. Combine Files. Review and Comment. Scan and Optimize. Mobile PDF. Protect PDFs. PDF Forms. Sign and Send PDFs. Print Production.