How to Open a Document Attached to a PDF File

Have you ever wanted to attach a document (e.g. a MS Word file) to a PDF document, and give the user the ability to launch that file with just a click on a button?

Usually, you have to save the attachment to a file, remember where you saved it, then go to that location and open the file using your Windows Explorer or the Finder on a Mac. With the solution I am about to present, that gets much easier to do for the user, but a bit more complex for the author of the PDF file.

Let’s assume we have two files, one PDF file named document.pdf and a MS Word document named attachment.docx – in the following you just have to replace your filenames with the ones that I am using.

I am using Acrobat DC Pro (running on a Mac) for the following instructions, this will work the same way (with slightly different tool names and a different user interface with older versions of Acrobat as well). You will need Adobe Acrobat – either Standard or Pro – for this, the free Reader is not able to create such documents.

Open your PDF document and go to the “Attachments” pane on the left side of the Acrobat user interface. The “Attachments” pane is represented by the paper clip icon:

2015 10 14 09 24 53

If you don’t see this pane, select the following menu to show it:

2015 10 14 09 26 24

Once the “Attachments” pane is displayed, click on the menu icon as indicated in the following screenshot, and select to add an attachment:

2015 10 14 09 27 37

Now navigate to the file you want to attach, select it and click “OK”. This should now show you the new attachment in the “Attachments” pane:

2015 10 14 09 32 37

So far we have not done anything special – this is just the process to attach a file to a PDF document. We could stop here and let the user figure out that there is actually an attachment in the PDF file, and how to open it. But that’s not what we set out to do, we want to make it obvious for the user how to display this attached document.

To do that, we need to add a button to the PDF document. There are two ways to do that: We can either open the form editor and then add a button (and deal with everything that comes with actually being in the form editor), or we can just add an interactive button. If this document is a form that contains other form fields, we of course would use the button function in the form editor, but if this is just one button we need to add, there is an easier way.

Just in case you are not yet familiar with the Acrobat DC user interface, it can be hard to find the one function you are looking for. That is why Adobe added a tool search function to Acrobat DC. There are two ways to search for tools: You can either use the search field at the top of the “Right Hand Pane” (or RHP for short), or you can select the “Tools” tab and then use the search field at the top of that dialog:

2015 10 14 09 37 05

2015 10 14 09 37 29

When we type in “Button” in that search field, Acrobat will tell us where the button tool is:

2015 10 14 09 40 26

This actually gives us two tools that we need: The tool to add a button, and the tool to select that button again and to modify it (if we need to make adjustments).

For now, just click on the “Add Button” search result. This dumps us right into the “Rich Media” toolset, with the Button tool selected. This means we can now place the button on the PDF page by moving it around to the correct location and then clicking to place it.

2015 10 14 09 42 28

At this time, the button tool is still selected, and we can double-click on the button to bring up it’s Properties dialog. This is where we need to make changes to give this button the ability to launch the attached Word document.

2015 10 14 09 45 42

Select the “Actions” tab (1), then select to create a “Mouse Up” action (2), select to run a JavaScript (3) and click on the “Add” button (4). This will bring up the JavaScript editor. Here we have to add a one line script.

This script will call the Doc.exportDataObject() method. You can find more information about this JavaScript method here: Acrobat JavaScript API – Doc.exportDataObject()

The trick here is to use the “nLaunch” parameter set to the value “2”, which has the following descrption:

  • If the value is 2, the file will be saved and then launched. Launching will prompt the user with a security alert warning if the file is not a PDF file. A temporary path is used, and the user will not be prompted for a save path. The temporary file that is created will be deleted by Acrobat upon application shutdown.

The command we are using also needs to reference the attachment name, which in our case is the filename we’ve originally imported:

this.exportDataObject({ cName: "attachment.docx", nLaunch: 2 });

Now close the editor by clicking “OK”.

A button is not very useful without a label (or an icon) on it. You can make these changes on the “Options” tab of the “Properties” dialog. After that, close the “Properties” dialog using the “Close” button and close the “Rich Media” toolset by clicking on the “x” on the right side of the toolbar.

When you now click on the button, you should see the following security dialog:

2015 10 14 10 06 17

This is it. You have a button that opens a Word document.

If you are trying to launch an attachment that is already in the PDF document, the filename you need to use for the JavaScript code is the name that is being displayed in the “Attachments” pane.

If you want to edit the button properties again, bring up the tool search function again, search for “button”, and now select the “Select Object” tool. The button should change it’s look, and you can now double-click on it to bring up the properties dialog again. Or, because now we know that the button is in the “Rich Media” toolset, we can go to the “Tools” tab and select this toolset directly:

2015 10 14 10 13 30

After the third time you’ve selected this tool, you probably wish that there would be an easier method of selecting the “Rich Media” toolset, and there is: You can drag&drop the toolset icon into the RHP:

2015 10 14 10 13 55

From now on, this toolset is just one button click away:

2015 10 14 10 14 21

You can download a PDF file with an embedded Word document form here: launchAttachment.pdf

Posted in Acrobat, JavaScript, PDF, Programming, Tutorial | Tagged , , , , , , | 31 Comments

Apply Standard PDF Form FIeld Formatting/Keystroke/Validation Events to Fields via JavaScript

For some options in Acrobat’s form editor, you can select multiple fields and then apply the same option to all selected fields. This works for example for the “read-only” flag, or the display options. It does however not work for things like formatting/keystroke/validation/calculation scripts.

It’s relatively easy to assign e.g. a custom validation script to many form fields in a PDF form via JavaScript. I do that all the time to cut down on manually editing fields. The following script validates that a text field contains data in a specific format:

Let’s assume we want to use the following script for all fields that contain a product number in a specific format, three upper case characters followed by a dash and three or four digits:

var re = /^[A-Z]{3}-[0-9]{3,4}$/;

if (event.value != "") {
    event.rc = re.test(event.value);
}

To assign this to all fields that have a name that starts with “product.” (e.g. product.124, product.999 and so on), we can use the following script:

var script = "var re = /^[A-Z]{3}-[0-9]{3,4}$/;\n" +
	"if (event.value != \"\") {\n" +
	"\tevent.rc = re.test(event.value);\n" +
	"}";

for (var i=0; i<this.numFields; i++) {
    var fName = this.getNthFieldName(i);
    if (fName.indexOf("product.") == 0) {
        this.getField(fName).setAction("Validate", script);
	}
}

That’s straight forward, the only potential problem is that the script needs to be formatted so that it is a valid JavaScript string (e.g. by escaping all quotes and some other special characters, replacing line breaks with ‘\n’ and so on). But, what if we want to use not a custom validation script, but one of the built-in formatting functions or range validations that Acrobat supports. Take a look at this one:

2015 09 13 17 51 43

This is a standard numeric format option for a value with two decimal places. How can we apply that to a number of fields in one operation? Yes, we can reimplement this in JavaScript, but what if I don’t want to go through the trouble of doing that, especially because Acrobat already knows how to do that?

The good news is that behind the scenes, even these built-in functions are handled via JavaScript. We just never see the actual script because Acrobat actually parses the scripts, and if it recognizes one of the built-in functions, it does not display the custom script dialog, it just says “that’s a number with two decimals”…

So, how do we find the script that Acrobat applies in the background? More good news: The tool to do that is built right into Acrobat Pro as well (unfortunately, not into Acrobat Standard): It’s the pre-flight tool.

Let’s create a quick sample document, add one form field, and apply the formatting routine from the screenshot above. Now bring up Preflight (e.g. Tools>Print Production>Preflight in Acrobat XI and DC) and select the menu item “Browse Internal PDF Structure…” in the “Options” menu:

2015 09 13 17 52 22

This will show us the “guts” of the PDF file. For the following, we need to know that form fields are stored in the “Annoys” dictionary on the page level. The following screen shot shows the structure of the PDF file with the relevant dictionaries expanded:

2015 09 13 17 53 06

We are looking for the “Page>Annots>N>AA” dictionary entry with “N” being the annotation number. In this case – because we only have one form field in our document, this is straight forward: We are using the annotation #0. In the “AA” dictionary, we see a number of different entries. If we are dealing with a formatting command, we usually see two items: The actual format script and a keystroke script.

The “AA” dictionary entry is describes in table 220 in the PDF specification (ISO 32000-2008), which points to table 194 for an explanation of the different trigger events. For the following, we will only consider the formatting, keystroke, validation and calculation triggers. They are defined (in this order) by the keys “F”, “K”, “V” and “C”.

In this case, we see two entries for “F” and “K”. Both have to dictionary entries on their own: “S” and “JS”. The “S” key indicates what type of action is saved in this dictionary. In our case, “JavaScript” indicates that we have indeed a script, and the “JS” key contains the actual script.

We find these two scripts: The formatting script looks like this:

AFNumber_Format(2, 0, 0, 0, "", true);

And the keystroke script is this:

AFNumber_Keystroke(2, 0, 0, 0, "", true);

Both scripts call an internal function. We could now play around with the options on the formatting dialog to figure out what the different parameters mean. This old page on Planet PDF has some additional information: http://www.planetpdf.com/forumarchive/125041.asp

For what we want to do, it’s sufficient to know what the scripts actually are, without fully understanding what exactly they do: If it’s good enough for Acrobat, it’s good enough for me 🙂
– if you do that, just make sure that you do not modify anything in these scripts.

To assign these two scripts to the Format and Keystroke triggers, we can use the following few lines of code:

var f = this.getField("SomeField");
f.setAction("Format", "AFNumber_Format(2, 0, 0, 0, \"\", true);");
f.setAction("Keystroke", "AFNumber_Keystroke(2, 0, 0, 0, \"\", true);");

You can of course combine this with a look that looks for certain fields, matching a certain pattern and then apply this change only to those fields. This can be done in e.g. an Action, or a Custom Command (see my previous post about Custom Commands for more information).

We have not discussed the validation and calculation scripts that Acrobat might add. The process is the same, all we need to do is either look for the “V” key for a validation script, or the “C” key for a calculation script (e.g. a simple field notation script or one of the simple calculation methods).

This is a very simple way to automate something that otherwise requires quite a bit of clicking and pasting of information.

Posted in Acrobat, JavaScript, PDF, Tutorial | Tagged , , , , , , , | 1 Comment

Security Envelope Templates (Still) Missing in Mac Version

Adobe Acrobat has had an interesting feature since at least Acrobat 8: A “Security Envelope” allows the user to pack any document into such an “envelope” and encrypt the contents. Only the recipient with the correct “key” can decrypt these files. This is not limited to just PDF files, you can add Word, Excel, InDesign, and other files as well.

Take a look at this old tutorial from Adobe’s AcroLaw blog for more information about how to do that:
http://blogs.adobe.com/acrolaw/2007/04/safely_send_groups_of_files_usin/

In Acrobat XI and DC, you can find this feature under Tools>Protection>More Options>Create Security Envelope (for Acrobat XI, replace “More Options” with “More Protection”):

2015 09 13 15 38 08

The way this function works is as follows: You first select the files you want to “stuff” into your envelope, then you select what envelope template you want to use, and then you select the security settings you want to apply.

When you run this in the Windows version of Acrobat, you see this dialog when you are supposed to select the security envelope template:

2015 09 13 15 27 50

As you can see, there are three default templates listed. On a Mac, these templates are missing:

2015 09 13 15 29 21

This is not a new bug in Acrobat DC, these three default templates have been missing for a long time. All we can do is to browse the filesystem and point this dialog to a security envelope template that’s installed somewhere.

These missing templates are actually installed, but Acrobat does not list them. Once you know what template name to search for (e.g. because you poked around the Windows version of Acrobat), it’s not too complicated to find them. They are stored in this folder (for the English version, other localized versions have their own directory parallel to en.lproj:

/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/en.lproj/DocTemplates

We have two options if we want to use them:

  1. We can click on the “Browse” button and then navigate to this location in Acrobat’s application bundle. Because the files are stored in the application bundle, we need a second Finder window in which we display this folder, and then drag&drop the file we want to use into the “Envelope Templates” open dialog.
  2. Or, we can copy these template files to a directory in e.g. the user’s “Documents” folder, then click on the “Browse” button and navigate to that directory. That’s a bit more straight forward, because we only have to navigate into the application bundle once in order to copy the files to our desired target directory.

Because option #2 is so much easier to use, the following will discuss how to set up such a copy of the templates folder.

Open up a Finder window and navigate to e.g. the “Documents” folder and select to create a new folder (e.g. via File>New Folder). Rename this folder so that it uses a meaningful name (e.g. “Acrobat Security Envelopes”).

Now open a second Finder window and navigate to your Acrobat application directory (e.g. /Applications/Adobe Acrobat DC/). Here you will find a number of application bundles, one of them being “Adobe Acrobat.app”. Right click on that bundle and select “Show Package Content” from the menu:

2015 09 13 15 30 33

Now you can navigate to “/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/en.lproj/DocTemplates” and select the three templates and copy them to your newly created directory.

From now on, all you need to do when you want to apply a Security Envelope Template is to click on the “Browse” button and then navigate to e.g. “Documents/Acrobat Security Envelopes”.

Another tutorial on Adobe’s AcroLaw blog also demonstrates how you can create your own templates: http://blogs.adobe.com/acrolaw/2007/04/custom_security_envelopes/

Posted in Acrobat, PDF, Tutorial | Tagged , , | Leave a comment

How to Count Radio Button Choices in Acrobat JavaScript

A question that comes up every now and then on either AcrobatUsers.com or in the Acrobat JavaScript Forum is about how to count how many radio buttons with a certain value were selected by a user. Let’s for example say you have a survey that has 10 yes/no options, and you want to know how often a user selected “yes”, you would have to count the “yes” answers and then display them in a text field.

How can that be automated?

The first thing you should do is to use a naming convention for your radio button groups. In the following example, I use the following convention: All radio button group names start with “RBGroup”, that is then followed by a period and an index. This means I have “RGBroup.1”, “RBGroup.2”, and so on. This makes it easy to iterate over all groups without having to know their exact names, and how many of them there are.

The next thing you do is to make sure that all radio buttons options are the same for all the groups that you want to process. If you want to use “yes/no” options, make sure that all “yes” option are spelled the same way – “Yes”, “YES”, and “yes” are considered to be different.

Now create one or more text fields that you set to read-only (you don’t want the user to try to override your calculations) and then use the following script as the custom calculation script for each of these “count” fields:

var testFor = "Choice1";
var groups = this.getField("RBGroup");
var ar = groups.getArray();
var cnt = 0;
for (var i=0; i<ar.length; i++) {
if (ar[i].value == testFor) {
cnt++;
}
}
event.value = cnt;

The only thing left to do is to change the first line and specify what the script is testing for (e.g. “Yes”, “No”, “Choice1”, and so on.

If you don’t have a naming convention for your radio button groups, you can still use the same approach, but you would have to list your group names in an array and then process the array to use the getField() method on each array element. 

Posted in Acrobat, JavaScript, PDF, Tutorial | Tagged , , , , | 19 Comments

Too Personal for Mobile Link? How to Remove Files From Document Cloud’s Recent List

When you use any recent version of Adobe Acrobat or Adobe Reader, and you gave in to the continued ‘nagging’ to turn on “Mobile Link”, then all the files you open in Acrobat or Reader will get uploaded to Adobe’s Document Cloud.

This can be a good thing, because it does not matter anymore if you are looking at a document on your desktop computer, the laptop, your tablet or your phone, it will always be there for the other devices to pick up where you left off. You can for example start to read a document on your laptop, and then finish reading it on your tablet – without having to manually sync the file.

Sometimes you may be working on a document that is too personal to be shared with the Document Cloud. In that case, you can turn off “Mobile Link” before you open that document, but what if you forgot about that, and the document got uploaded? How does one remove such a document from Adobe’s Cloud storage.

Here is what you do:

When you go to http://cloud.acrobat.com you can see all Cloud related options – there are the web services to convert from and to PDF (Export PDF, Create PDF, Combine Files, …), but also all your cloud storage (Document Cloud, Creative Cloud). In addition to that, there are two list of files: “Recent Files” and “Sent Files”:

2015 04 24 11 35 01

When you select “Recent” – which you can also do by using the shortcut http://cloud.acrobat.com/recent – you will see all files that you’ve recently used in any copy of Acrobat or Reader that had “Mobile Link” enabled. You can delete files from that list by selecting the checkbox to the left of a filename, and then selecting “Delete” from the tools selection just above the list of files (as indicated in the screen shot).

You may want to spend a minute to think about if you really want every file you touch to be uploaded to Adobe’s Document Cloud. I touch a lot of files on a daily basis, and I don’t want for example files that were provided by my customers to be stored outside of what I can control. Adobe says that storing data in the Document Cloud service is save, and I don’t have any indication to question that, but I am not taking any risks, so my “Mobile Link” is turned off unless I have a good reason to turn it on (e.g. to take screenshots for a blog post 🙂 )

If you want to store a file in the cloud, you can do that deliberately by selecting “Save As”, then select “Document Cloud” instead of the “My Computer” option:

2015 04 24 11 56 32

This way, you have full control over where documents are stored, and don’t end up uploading files that are “too personal” to the Cloud.

Posted in Acrobat, Tutorial | Tagged , , , , , | 4 Comments

Create Custom Commands in Adobe Acrobat DC Pro

Background

In Acrobat XI and older, when you wanted to run e.g. a custom JavaScript, you had to create a folder level script and find the correct directory to install it, or create a custom Action using the Action Wizard, and then deal with the overhead of running an Action. In Acrobat DC Pro, this got a lot easier with the introduction of “Custom Commands”. A custom command is a user defined command that can be used just like the built-in commands. This means it can e.g. be added to the toolbar, or be used in an Action.

Let’s see how we can create and use custom commands.

Creating Custom Commands

Let’s assume we want to create a custom command that counts bookmarks in a document. Not very creative, but I already have a script for that in one of my old blog posts. This also demonstrates how much easier this is compared to using a JavaScript menu item.

In Acrobat DC, we need to switch to the “Tools” view and then access the “Action Wizard” tool:

2015 04 17 15 53 04

Once selected, the Action Wizard allows us to create, manage and execute Actions (just like the Action Wizard in Acrobat X Pro or XI Pro), but is also has functionality to create and manage custom commands:

2015 04 17 15 53 52

Just like the name implies, the function “New Custom Command” creates a new custom command. When we execute this function, we get a dialog that lets us select what command we want to use as part of our custom command. This can for example be a preflight profile with specific settings, so that the user does not have to configure the preflight tool manually. When executed, the custom command would configure preflight, select the correct profile and run it. We are trying to execute some JavaScript, we therefore select the “Execute JavaScript” option from the “Customizable Commands” list:

2015 04 17 15 59 38

On this dialog, we first select which customizable command we want to run (1), then we provide a name and a tooltip for our custom command (2) (3). The custom command gets configured by clicking on the “Command Options…” button (4). As the last step, we need to make sure that the custom command does not prompt the user for information that we’ve already specified as “Command Options” (5). For some custom commands, it may be necessary to display the Command Options dialog, but for what we are going to do with JavaScript, it would just get in the way of a smooth user experience.

When we click on “Command Options”, we get to the JavaScript editor. Here is the code that we are using to count bookmarks:

function CountBookmarks(bkm, nLevel) {
	var count = 0;
	if (bkm.children != null) {
		count = bkm.children.length;
		for (var i = 0; i < bkm.children.length; i++) {
			count += CountBookmarks(bkm.children[i], nLevel + 1);
		}
	}

	return count;
}


(function() {
	console.clear();
	console.show();
	var n = CountBookmarks(this.bookmarkRoot, 0);
	console.println("Number of bookmarks found: " + n);
})();

If you are confused by the anonymous, self-executing function, take a look here for more information: http://esbueno.noahstokes.com/post/77292606977/self-executing-anonymous-functions-or-how-to-write. I am using such an anonymous function so that any variables that get declared are local to that function, and don’t interfere with any other JavaScript in Acrobat.

Now that we’ve created our own custom command, we can execute it from the Action Wizard user interface:

2015 04 17 16 10 59

What else can we do with a custom command?

Using Custom Commands

Let’s add the custom command to our Acrobat toolbar. To do that, we right-click on the gray background of the toolbar. This brings up a menu that allows us to select the “Customize Quick Tools” function:

2015 04 17 16 21 09

After we select “Customize Quick Tools”, we can then add commands to the Quick Tools area on the toolbar. The tools we can add are built-in tools (e.g. the “Sticky Notes” tool so that it can be used with just one mouse click), but also our custom commands (and all Actions created with the Action Wizard). We need to expand the “Action Wizard” section to get to the custom commands. Once selected, we click on the “move item up” button on the right side to actually move it to the Quick Tools toolbar. Now we just have to select to “Show Quick Tools” in the right-click menu from before. If the menu item is “Hide Quick Tools”, then the Quick Tools are already shown.

Another option to use a custom command is to create a new group of tools called a Custom Tool. We create such a Custom tool by clicking on the “Create Custom Tool” icon in Acrobat’s “Tools” area:

2015 04 17 16 28 01

We can now add our tools either to the toolbar via the “Up Arrow”, or to the “Right Hand Panel” (RHP) via the “Right Arrow” button. The following shows how the toolbar and RHP look for a custom tool:

2015 04 17 16 46 25

There you have it, a very easy way to create custom commands that can be added to Acrobat’s user interface.

Posted in Acrobat, JavaScript, Tutorial | Tagged , , , | 129 Comments

Acrobat DC is Here – You may want to wait with upgrading until you read this…

[Update: Adobe added a warning to the CC updater that informs the user that older versions of Acrobat will be removed, and a knowledge base article about this problem: https://helpx.adobe.com/creative-cloud/kb/acrobat-dc-uninstalls-acrobat-11.html ]

As announced by Adobe a few weeks ago, they released Adobe Acrobat DC and last night. If you have a Creative Cloud subscription, you can get Acrobat DC today – with just one mouse click. You may want to hold off upgrading Acrobat XI to DC for a few moments and save all custom elements that you installed in Acrobat XI: The upgrade will remove Acrobat XI completely from your system, and with it all custom scripts, stamps, plug-ins and other things that you may have installed for all users in Acrobat’s application directory.

Before you upgrade, find out where Acrobat XI is installed on your computer (on a Mac, that would be /Applications/Adobe Acrobat XI Pro, on a Windows system it may be C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat) and save all these custom elements to a different directory.

Once you’ve done that, feel free to click on that “Upgrade” button. You can now install these plug-ins, stamps, scripts, … back into the new Acrobat DC application directory.

If you’ve already upgraded, then you will have to use your backup to recover these files.

Keep in mind that the user interface of Acrobat DC is completely different than what you had with Acrobat XI, so plan for some serious hunting for tools that you could find blindfolded… The tool search function on the right hand pane is our friend.

More about Adobe Acrobat DC soon…

Posted in Acrobat | Tagged | 23 Comments

Missing Characters After Merging or Inserting PDF Files? Here is a Potential Workaround

Have you ever tried to merge a few files and ended up with missing characters on some of your pages in the resulting PDF file? Here is a description of one of these instances – as a question posted on Acobatusers.com: https://answers.acrobatusers.com/text-missing-combining-q134046.aspx

I’ve never seen this problem first hand, and therefore was not able to find a workaround that would fix it. I’ve asked for sample files for many years, but never got anything useful. I finally struck gold and received a couple of files that show this problem.

Once I had access to a file that had missing characters, I tried a number of different things. I’ve always suggested to un-embed fonts, so that was the first thing I tried. You can un-embed fonts using the PDF Optimizer (File>Save as Other>Optimized PDF…) in Adobe Acrobat XI Pro (unfortunately, the ‘Standard’ version does not have this feature). When you bring up the optimizer, you can configure different categories. I unselected all of them with the exception of “Fonts”, and then selected to un-embed all fonts. Acrobat crashed. It crashed on both Windows and the Mac. So much for the workaround I had suggested in the past…

After a few more unsuccessful attempts, I ended up with a process that works – at least for the files that I had access to. Here are the steps you need to take:

Open the file in Acrobat XI Pro. I assume you have the merge result, so some characters will be missing:

Screenshot of missing characters

The first thing we need to do is to split the document into it’s individual pages. This can be done using Tools>Pages>Split:

Select 'Split Document'

On the split dialog, select to split after every page:

Screenshot of 'Split Document' Dialog

Click on the “Output Options” and select to save the split pages in a separate directory. That will make it easier to merge these files again, once we are done. When you check the output files corresponding to pages with missing characters, you will notice that the characters are still missing.

Now that we have individual pages, we can fix the font problems. We could do this manually for each file (and if you only have two pages, that may actually be the faster method), but for many pages, it’s easier to have an Action that takes care of that.

To create an Action, select Tools>Action Wizard>Create New Action… (on the Mac, you will have to open a document to have access to this function – I always use Cmd-Shift-T to create a blank document). On the “Action Wizard” dialog, expand the “Save&Export” section and select the “Save” step. Now either double-click on Save, or use the “+” button in the middle of the dialog to move it to the right side. To specify the save options, click on “Specify Settings”:

Screenshot of 'Create New Action' Dialog

This will display the “Output Options” dialog. Select to run the “PDF Optimizer” and click on the associated “Settings” button:

Screenshot of 'Output Options' Dialog

The next dialog looks like the PDF Optimizer dialog that pops up when you select File>Save as Other>Optimized PDF, so if you want to do this step manually, the same settings apply.

On the “PDF Optimizer” dialog select to retain the current PDF version (“Make compatible with”), unselect all categories but the “Fonts” category and select to “Subset all embedded fonts”:

Screenshot of 'PDF Optimizer' Dialog

Click on the “OK” button and provide a name for the just created PDF Optimizer configuration (e.g. “Subset embedded fonts”). Click “OK” again and then save the newly created Action under a meaningful name (e.g. “Subset embedded fonts”):

Screenshot of 'Save Action' Dialog

Now we can process all the individual pages we converted the original document to. On the “Action Wizard” panel click on the new Action to start it. This will allow you to select all documents to process. If there is anything listed in “Files to be processed:”, remove any existing entry (The active document will be listed if it’s a document that was already saved to disk. If you created a blank document on a Mac, that document will not be listed – unless you saved it since creating it). Click on the “Add Files” button, browse to the directory where you saved your individual pages, and select all of them. Don’t worry about the order in which the files are listed, the order in which the files are processed does not matter. Then click on the green “Start” button. This will now process all files by opening them and saving them with the settings we have specified. Once done, you should be able to verify that the missing characters are back again. BTW, the last file processed will remain open, you can close that without any problems.

All that’s left to do is to merge the files back into a single PDF file. Select File>Create>Combine Files into a Single PDF… On the dialog that gets displayed, click on the “Options” button:

Screenshot of 'Combine Files>Options' Dialog

Make sure that “Single PDF” and the “Large file size” are selected – as indicated in the screen shot. Click “OK” to get back to the “Combine Files” dialog. Click on the “Add Files…” button, browse to the directory with the individual PDF pages and select all of them. All files names should now be listed in the correct order. If not, you can re-arrange list list by dragging an entry to it’s correct location, or by moving items to the front or the end of the list using the arrow buttons below the list.

Screenshot of 'Combine Files' Dialog

After clicking on the “Combine Files” button, you will get a file with the same pages as in the original file, but now without missing characters.

If your original file has bookmarks, or other interactive features, you may want to replace all pages in the original document with the pages from the just created new document. This will make sure that all interactive features are still working. You can do that by selecting Tools>Pages>Replace.

Screenshot of fixed document

What I describe here may not work for your specific file, but give it a try and let me know in the comments what your experience is.

[Update] If you want to understand why this is happening, I wrote a long explanation about the technical background here: https://answers.acrobatusers.com/ViewQuestion.aspx?questionId=190200&#answer237469

Posted in Acrobat, PDF, Tutorial | Tagged , , , , | 51 Comments

“No Pages Selected To Print” Error

UPDATE: See Vishal’s comment in the comment section. Adobe is looking for help in debugging this problem. If you are running into this problem and want me to share your email address with Adobe, please get in touch with me via email. My email address is on the “About” page.

Update 2: Here a link to some debugging tips from an Adobe employee.

For a while now, Adobe Acrobat or the free Adobe Reader will in some instances display an error message that suggests that there were no pages selected to print when the user tries to print any PDF document.

This error message is obviously wrong and misleading. From outside Adobe, it’s impossible to say what exactly triggers this error message, and how the original problem can be fixed. Most people will never see this error, but for some users, it will show up every time they try to print.

NoPagesSelected

If you are dealing with this error message, and you are using Acrobat or Reader on Windows, there is a simple workaround. This is not a fix, and does come at a price, but at least it will allow you to print:

Open up Acrobat’s (or Reader’s) preferences (Edit>Preferences or Edit>Preferences>General), then select the “Security (Enhanced)” category.

Now deselect the setting “Enable Protected Mode at Startup” and restart the application.

If this does not work, try to set “Protected View” to “Off”.

This will work in most instances, but because we don’t know what the exact condition is that causes this problem, your print operation may still fail. In that case, your only option is to get in touch with Adobe’s support.

Keep in mind that disabling Protected Mode/View has security implications. You can find out more about what Protected Mode/View does in Adobe’s Acrobat documentation.

If you are using Acrobat or Reader on a Mac (or if the previous change did not fix your problem on a Windows system), your only option is to “Print as Image”. You can find this option after clicking on the “Advanced” button on Acrobat/Reader’s print dialog. Again, this should help, but there may be instances where this still does not allow you to print, and your only option is to get in touch with Adobe’s support.

Posted in Acrobat, PDF | Tagged , , | 80 Comments

Save Your Acrobat.com Workspaces Files

Up until recently, there were two ways to save a document on Acrobat.com:

  1. The old “Workspaces” section
  2. The new “Files” section

Adobe announced a while ago that the “Workspaces” service will be discontinued on Jan 6th 2015. Write access to this section of Acrobat.com is no longer available (at least it’s no longer working for me, even though the “Upload” button is still available).

In order to not risk losing your files, download them before January 6, 2015. To make this simple, Adobe put a huge button on the site that is hard to miss. Just click on the button, and the website will create an archive of all your files, and will send and email notification once this archive is available for download:

2014 10 10 08 22 20

If you do receive an error document during the export, take a look at this Adobe document, which explains how to deal with such errors: https://forums.adobe.com/docs/DOC-4527 – this link will also be in the email notification you receive after your files are ready to download.

Posted in Acrobat, PDF | 2 Comments