Export many PDFs at once… plus security

A recent question on Reddit’s InDesign subreddit was whether two PDFs could be exported at the same time from the same document, but have two different properties – one with trims and one without. The answer is yes, but via a custom script written for the task.

I use such a script on a daily basis so that I can prepare a PDF for client proofing via email; and a separate PDF that has trim and crops that is sent directly to a hot-folder that prints it for me.

I’d submitted my script as a solution (that can be downloaded from the scripts page), but then realised that this concept was not a new idea. Ariel Walden over at ID-Extras had already written a similar script within a blog post of his own.

Similarly, Peter Kahrel’s Batch Convert script can perform the same task, with the added advantage that it can also do this for all open InDesign documents;

Or if no documents are open, a specified folder (and subfolders if desired) of InDesign files.

Can’t make these secure

One feature that all three scripts have in common is that the exports are based on the PDF presets available on the user’s machine. One feature that can’t be added to a PDF preset is security – this can only be done when a request to export the document is made, as security settings aren’t saved into PDF presets.

This is a problem if there are lots of documents that need to be exported with security settings as it requires the user to enter the security details each time a PDF is exported.

I’ve made an additional script

For this purpose, I thought I would make a script that not only makes several PDFs, but can also add password security to one version. The script can be downloaded from the scripts page.

When the script is run, it will generate two PDFs using different PDF export settings, but one will have the suffix “_secure” added to the filename, and a dialog box will appear once the export is finished:

Adjustability

The script can also be adjusted by opening the script in any text editing application and making the necessary changes, such as.

Use the same password for every document

Look for the line

    openDocumentPassword = myPassOpen; // requires a password to open the document

and change the myPassOpen to the desired password in quotations. For example:

    openDocumentPassword = "OpenSesame"; // requires a password to open the document

Similarly, do the same thing for the line underneath, making sure that the open password and edit password are not the same.

    changeSecurityPassword = myPassWrite; // requires a password to change the document

change to

    changeSecurityPassword = "EditSesame"; // requires a password to change the document

then search for the lines

dialog.show();
//alert("Done");

and swap the forward slashes in the lines around so that the lines now read like this.

//dialog.show();
alert("Done");

Only require a password to edit the document

Look for the following line:

    openDocumentPassword = myPassOpen; // requires a password to open the document

and add two forward slashes to the start of the line.

//    openDocumentPassword = myPassOpen; // requires a password to open the document

Adding two forward slashes to a line in a javascript tells the script to ignore the rest of the line and go to the next line of code.

Don’t show the “done” message

The default script has a dialog at the end for showing what the opening and editing passwords are, but if you want to edit the script so it makes a PDF that applies security to edit the document but does not provide the password (e.g. for the purpose of handing PDFs over to parties who may seek to deconstruct them in other applications) then make the adjustment mentioned a moment ago to restrict passwording to editing only, and then search for the lines

dialog.show();
//alert("Done");

and swap the forward slashes in the lines around so that the lines now read like this.

//dialog.show();
alert("Done");

Add more PDF exports

Look for the line

app.activeDocument.exportFile(ExportFormat.pdfType, File(resultsFolder + "/" + app.activeDocument.name.split(".indd")[0] + ".pdf"), false, "[High Quality Print]");

make a copy of the line and make the appropriate changes:

  • Replace the “[High Quality Print]” to the desired PDF preset exactly as it is written in the PDF export dialog box and put it in quotes. For example, if your PDF preset is called My Export then type “My Export”
  • Replace the “.pdf” with a suffix that denotes that this is an additional PDF. For example, if the pdf is a high res print, perhaps replace this with “_hi-res.pdf” so that the resulting file has _hi-res.pdf at the end of its filename.

Otherwise if you are after specific changes to the script to suit your needs, contact me via the contact page.

Things to know about the script

Opening and editing passwords must be different

One condition of preparing a secure PDF from Adobe InDesign is that the password required to open the PDF must be different to the password to edit the PDF, so if editing the script to replace the randomly generated password to a known one, the opening and editing passwords must be different. If the passwords are the same, the PDF will be made without security.

PDF Standard in the preset must be set to “None”

PDFs that use a PDFX standards can’t have security applied to them as the security panel of the PDF export box is greyed out, preventing security to be applied. The standards dropdown box in the desired PDF preset must be set to None.

Only password security is applied

When exporting a PDF from InDesign, only password security can be applied, unlike Adobe Acrobat’s choices of security that it can offer (as shown below).

While password security may deter or prevent a layperson from editing the PDF, the security can be broken through some effort. Several websites offer services where users can drag and drop a PDF to the site, and within moments the PDF will have the PDF password removed.

Similarly, there are desktop applications that can also be purchased to remove the security (as one of their many features), such as PDFsam Visual.

Outlining the problem… text outlining

From time to time, I will prepare PDF artwork for third party providers and then note that their specifications indicate “Convert all text to outlines” (also known as converting to curves or paths). But why do some third parties recommend this practice?

The PDF is opened in software other than Acrobat

For commercial printers, PDFs are usually imported into Raster Image Processing (RIP) software that will impose and trap the artwork for their printing methods. However, not all providers work this way and may need to open the PDF in applications other than Adobe Acrobat. For example, a third party that prepares cutting formes may open the file in Corel Draw or a CAD application that supports its CNC software.

This means that as the file opens, the application may ask for fonts not available to the third party.

This can be exacerbated if the PDF is opened not only in a different application than Adobe Acrobat, but also a different alphabet and writing system. Converting the type to outlines maintains the appearance of the type without requiring the font to be present.

Other reasons that text is converted to outlines

So special effects can be applied

InDesign, Illustrator and Photoshop can apply interesting special effects to vector objects, but not all of those effects can be applied to live type. The solution is to convert the type to outlines, thus converting the type to vector shapes that can have the desired effect applied.

To prevent editing by third parties

Limited editing is possible within PDFs using either Acrobat’s own editing tools or using plugins such as Enfocus Pitstop Professional. These tools can allow last minute alterations to text so long as the text is type and not converted to outlines.

Locking the PDF with password protection isn’t an option as this can prevent the file from being placed into layout software or RIP software for output, so the password is then required to unlock the file. PDF password protection is also somewhat breakable, with many websites offering services where PDFs can be uploaded, and then unlocked and then downloaded without the password protection. There are also PDF editing and viewing applications such as PDF Sam that allow for decryption of PDFs.

Even without the Enfocus Pitstop plug-in, it is possible to open PDFs in Adobe Illustrator or Affinity Publisher and then – if the fonts are available – make the necessary alterations… though converting type to outlines will prevent this.

To circumvent the font EULA

A client may have acquired a font that has allowed for screen use only and prohibits embedding in a PDF, preventing the font from appearing correctly in the PDF. A way around this is to convert the type to outlines in the native application prior to PDF export, though it is worth noting that the End User Licence Agreement (EULA) of the font may forbid this workaround, so it is worth reading the font EULA.

That doesn’t mean it should be done!

There are issues that arise from converting type to outlines. Dov Isaacs – Principal Scientist for Adobe Systems – has a brilliant PDF that details this (and much more) but the basic takeaways concerning type to outlines are:

  • Increased filesize that takes forever to download or view onscreen
  • Smaller typefaces do not render as well
  • May potentially breach the font’s EULA

In addition, there are other issues such as:

  • Potential issues with fonts where type overlaps itself (it can knock out holes in the joins)
  • If the conversion from type to outlines has been done in the native application and then accidentally saved and closed, this means the type will no longer be live in the native application.
  • It can prevent or hinder minor type alterations being made in a PDF submitted for print.
  • Text (as outlines) that has special effects applied (as described earlier) may not always be able to have the same effect applied to live type. This can create issues with variable data campaigns where the effect needs to be applied to a text variable.
  • It can make it difficult to identify the font used, as the font’s information is no longer in the PDF and the only other way to identify the font is visually or with apps such as what the font, adobe capture, or identifont.
  • The conversion is usually a one-way conversion. There is a fantastic Adobe Illustrator plug-in from Astute Graphics called Vector First Aid 2 that – in some circumstances – can convert outlines back to type, but it isn’t a magic bullet (though definitely worth a look).

If your hand is forced…

In a perfect world, I’d only deal with providers that fully supported PDF/X-4 files. Unfortunately, not all providers do, and occasionally our hands will be forced into providing PDFs specifically as the provider has requested, which may mean converting text to outlines. Rather than doing this in the native application (e.g. InDesign or Illustrator) there is a great way to quickly convert all type to outlines using an Adobe Acrobat Preflight that is detailed over at CreativePro.

Small tips to save big time

I often find it interesting to watch the different ways that my colleagues and I may perform the same task. Take the InDesign command Paste in Place for example. I’ll typically use the keyboard shortcut, but I’ve noticed that one colleague will go to the edit menu and select it from there; another will right-click and access it through the contextual menu, while another has an ergonomic mouse that has the shortcut hot-keyed to an additional button (No-one used InDesign’s quick apply panel).

While there are many ways to accomplish the same task, they all take different amounts of time and hand travel. A two-handed keyboard shortcut takes less time than navigating through the menus and – if using a mouse – leaves the cursor in its last position; but takes one hand off of the mouse briefly. In my situation, I’m using a Wacom tablet, so after using a keyboard shortcut, I then have to reposition the cursor as I’m usually still holding the stylus in my right hand. I’m also not a fan of the gymnastics my hands have to often do to in order to execute a task, and recently I’ve been hot-keying eight of my commonly used shortcuts to the contextual menu of my stylus.

Luckily in the Paste in Place example, there is more than one way to accomplish the task, and there’s no right way to use this – it is whatever is most comfortable for the user. What I would like to highlight in today’s article is how to accomplish common tasks more efficiently.

It is worth pointing out that this isn’t an exhaustive list and doesn’t get into details that might require the purchase of dedicated software such as Digital Asset Management software, or the creation of hot folders from software such as EFI Fiery Command Workstation, but is a few tips that anyone of any skill level can take advantage of to save a minute here and there from their workflows.

Within InDesign

Add your own interface items

The option to edit Keyboard Shortcuts and Menus can be found from the Edit menu

Keyboard Shortcuts (KBSC)

From the keyboard shortcuts menu, it is possible to assign keyboard shortcuts to items that do not have shortcuts assigned by default, as well as redefine shortcuts from the defaults. Shortcuts can also extend to scripts in the scripts panel as well.

Add own menu items

It is possible to make your own set of menu items using InDesign’s own menu customisation, but this only allows users to create their own menu sets based on the default set – you can’t make your own new items… without scripting. Indiscript’s Marc Autret has an article where he explains an overview of how this can be done, and provides examples as well.

Add own contextual menu items

Adding the Draw Measurement Arrows script to the contextual menu.

Silicon Publishing’s Ole Kvern wrote an article about making a contextual menu startup script that adds functionality to the contextual menu available via the right mouse button. However, I’ve since added my own functionality based on his script by editing the script in a text editor and adding my own items.

Improve on viewing the current items

Customise workspaces

Does every tool need to be visible or docked all at once? Perhaps consider making workspaces more appropriate to the workspace that is actually being used. InDesign ships with some defaults that behave this way, but it is worth experimenting.

Using Bart van de Wiele’s CreativePro 2020 tip to make a custom links palette separate to the usual links palette.

An extreme (and clever) example was demonstrated at the CreativePro 2020 Online Conference by Adobe’s Bart van de Wiele. In the 3 minutes max session, he demonstrated a way of customising the Links palette and saving it as its own workspace – allowing more information about a link to be viewed briefly, and then navigating back to the regular workspace.

Improvement on the scripts panel

Peter Kahrel’s runscript user interface

InDesign’s default script panel literally mirrors how the scripts are filed in finder/explorer, but is missing many features such as a search facility and could really use an overhaul, given its appearance hasn’t changed since InDesign was released. Luckily, Peter Kahrel has made his own launcher that allows scripts to be filtered by name.

Within any application

Not all tips are specific to Adobe InDesign. One Adobe application in particular – Adobe Acrobat – has long been criticised for its lack of customisation, so any opportunity to improve its use is appreciated.

Better navigation

Use dictation

For users that hunt and peck the keys rather than touch-typing, it is worth considering using the real-time dictation features in Mac and Windows operating systems (and some specific software) as word recognition is on par with typing speeds up to 90 words per minute or more.

Learn the new OS features

Each time the operating system is updated, it is worth paying attention to the changes made by the platform for any time-saving features. One example from my own circumstances is using spotlight to access applications rather than the dock.

Default Folder X

I was introduced to this paid Mac plug-in from St Clair Software several years ago and I’ve been using it since. It extends the functionality of save as dialogs which provides recent folders, open folders and favorites.

Controller specific shortcuts

While keyboard shortcuts were mentioned earlier in the article, it is worth noting that they can usually be applied as buttons to controllers that are beyond the usual two-button mice that can be found in an office.

Wacom Stylus

The default radial menu accessed via the Wacom Desktop Center

I’ve used the base-model stylus for years. In addition to the buttons on the stylus, there are four more buttons on the tablet; and the ability to call upon a contextual menu with one of the stylus buttons that allows more tasks to be carried out.

Gaming mice

Mapping custom keys to the Logitech G300S gaming mouse.

I was introduced to this tip once again at CreativePro 2020 online, and it seemed like such a simple idea that I’d wondered why it hadn’t been implemented in my workplace. For example, a base-model gaming mouse such as the Logitech G300S has nine programmable buttons.

Touch portal

A simulated appearance of an iPad using sideshowfx’s Photoshop shortcuts via Touch Portal.

Long-known to live-stream performers on Twitch and Youtube is a product called the Elgato Streamdeck. Put simply, it is an additional keyboard that is customizable to quickly access shortcuts via one button instead of the keyboard gymnastics that can come with some keyboard shortcuts.

A cheaper alternative is software called Touch Portal, and this turns a smartphone or tablet into a streamdeck-like device – ideal for anyone who has an old smartphone or tablet that isn’t otherwise in daily use. The free version is limited to two screens with eight icons each, but a paid version is offered with far more extensibility at a price that is affordable for any pocket.

While this does require its own customisation, SideShowFX has boxed up a collection of Photoshop, Illustrator, After Effects and Premiere shortcuts that are ready to install. Their youtube page has a great explanation of how it all works.

Have it your way

Ultimately, these are solutions that I find helpful, but I like to keep an open mind to new techniques and strategies to get my work done efficiently and accurately. If you have any techniques or strategies you would like to share, please leave a comment or get in touch directly via the contact page.

Referencing pages of a multi-page PDF file during data merge… workaround

At the time of writing, there are three multi-page/artboard file formats that Adobe InDesign can import when placing a file via the File/Place function. These formats are:

  • PDF
  • Adobe Illustrator
  • Adobe InDesign

(While it is possible to create many artboards in Adobe Photoshop, it is not possible to import a specific Photoshop artboard into Adobe InDesign… – at the time of writing that is – but that is another article!)

When placing one of these three formats, it is possible to control several import functions using the show import dialog box, such as:

  • Which page (or pages) to import;
  • How the pages should be cropped;
  • Whether or not to place the pages with a transparent background; and
  • What layers to show and their visibility;

However, when importing these file types as variable images during a data merge, these options are unavailable and replaced with the following:

  • Only the first absolute page of the file is imported (not always the page numbered 1 as the first page can also be – for example – in roman numerals or start at a page other than one); and
  • Page cropping, transparency and layer visibility is determined by the same variables as the last file of that type to be placed into the artwork.

For now, there is no workaround to control the latter issues during a data merge, other than to be familiar with this behaviour and plan the merge accordingly. There is a workaround for importing pages beyond the first page of a PDF file… but not an Illustrator or InDesign file.

Workaround: Split the PDF

The term “workaround” is used loosely in this context. Unfortunately, the solution is to break the PDFs into single page records. This can be done within Acrobat using the split button from the organise pages panel.

This feature also allows multiple files to be split at once.

By default, the resulting files will maintain the same filename with the addition of _Partx prior to the filename, with x representing the absolute page number.

Otherwise, I’ve prepared an action that you can download here that will save the PDFs to the Documents folder of the machine running the action.

(Yes, I’m also aware that there are quite literally hundreds of websites out there that will split multi-page PDFs to single PDFs for free. However, the methods outlined above will do so without involving a third party).

The next part of the workaround involves the data itself, and I’ll be using Microsoft Excel to create formulas to make the numbering for the resulting pages. All variable images being referenced will also be in the same folder as the data file, meaning only the filename is required and not the full path and the filename.

For data where the page number is known

Add a column to the database that references the absolute PDF page number that needs to be imported.

Absolute vs Section numbers abridged:

Absolute numbers refers to a page number based on the total count of pages in the document, while section numbers refers to the page number that was applied using page numbering in the application that made the PDF.

For example, take a PDF that contains 20 pages with the first six pages being in roman numerals, and the remainder being in decimal numbers. These two different styles of numbering are section numbers, while absolute page numbers refer to the total count of pages. To reference page iv of the PDF, the absolute page number to reference is 4. To reference page 5 of the PDF, the absolute page number reference is 11.

In this example, the A column represents the PDF to reference, the B column represents the absolute page number, and C represents the result. To obtain this result, the following formula can be used:

=SUBSTITUTE(A2,".PDF","_Part"&B2&".pdf")

This formula will look at filename reference and substitute the .PDF portion of the filename for _Partx.pdf, where x represents the figure in the B column. Using this formula, only filenames with the PDF extension will be affected, while filenames in other formats will be unaffected.

For data where the page reference needs to increment by one more than the row above

The same formula can be used for the naming, but another formula is used to determine if the page reference should increase if the same base file is being referenced in the row directly above.

In this example, the N column represents the PDF to reference, the O column represents the absolute page number, and P represents the result. A 24 page file NS91912 is being merged and needs to have the page reference incremented by one so that the filenames are NS91912_Part1.pdf to NS91912_Part24.pdf. The following formula can be used to change the page reference:

=IF(N2=N1,O1+1,1)

This formula will look at the filename and determine that if the filename is different to the row above, put the number 1 in the cell, BUT if the filename is the same as the row above, take the page value from the cell above and add 1 to it into this cell.

In a perfect world

Again, this is a workaround – it will only work for PDFs and requires some upfront work to prepare. Ideally, if I had my way and could implement some improvements, I’d like to see:

  • Not just the ability to choose a specific page, but choose the correct trim box and layers as well. For example, a file reference such as myFile.pdf;1,trim;Layer1,Layer2 where 1 represents the absolute page number, trim represents what trim box to use, and Layer1,Layer2 represent the layers I would like to appear (or leave the layer bit blank if all layers should be visible).
  • The ability to perform a similar task for incoming INDD, AI or PSD files.
%d bloggers like this: