Playing with PDFs

In the book of things you didn’t know you can do in Fiji, I’ll bet we’re going to cover a couple here today. The Research community uses the Portable Document Format as the de facto standard for ‘reprints’ of published articles. In this post, we’ll look at how to open, modify, save and deconstruct PDF files all from the comfort of Fiji.

Opening PDFs

If you drag a pdf file into Fiji, you’re going to be disappointed. The default PDF handler opens the document (as an image)  at a pretty low resolution. The multi-page PDF opens as a stack of images at 584×782 pixels which is what Fiji calls a scale of 100% (below, top).

2015-09-PDFs-03

Images imported at 100% (top) and 300% (bottom) scale. The original paper was from PNAS (so probably formatted for US letter paper)

Fear not though, as if you instead run [File > Import > PDF] you can select the scale from 100% to 1000%. Anything smaller than 300% isn’t much use for standard text and images and anything bigger than 600% is probably not that useful and will take much longer to open and manipulate.

NOTE: I thought these numbers had something to do with dpi and that seemed about right, but if you work it out, for letter paper (which is 8.5×11 inches), importing at 100% scale gives you a 71 dpi image. If you assume it’s working on A4 paper you get ~67dpi, so that’s not right either.

Extracting Images

This is a really cool feature that the average user is unlikely to ever accidentally find. Despite that, it’s really useful for preparing Journal Club presentations or even if you just want to have a closer look at data included in papers (for instance to spot sneaky image manipulations).

If you run [File > Import > Extract Images from PDF] and point Fiji towards a pdf of choice, you’ll be presented with each of the embedded images in a separate window. Unlike opening whole PDF files (above) the images will be in their original resolution.

2015-09-PDFs-01

Images from doi:10.1073/pnas.1510581112 used in the preparation of a PubPeer Comment.

Saving PDFs

OK so you can open PDF files, but what about saving images as PDFs? Sure you can do this but it comes with quite a significant caveat:

The thing that puts the ‘P’ in PDFs are that they encapsulate a description of the formatting, layout and content of the document so that when you open the document (on any platform) it displays the contents in the same way. When you open PDFs in Fiji, you read out all of this information and construct an image based on that description.

Therefore, any data you save as a PDF from Fiji, will be:

  1. bigger than the original
  2. not editable in a vector graphics / pdf program
  3. uninteractable (no fillable forms, highlighting, comments &c.)

With that said, there are some times that you don’t care about this, for instance putting images (Figures?) together in a single document, making an index-sheet for a meeting or lab-book, or collating scans of various documents.

With the warning out of the way, to save as a PDF, use [File > Export > PDF] and you’ll be presented with the following dialog:

2015-09-PDFs-04It’s not immediately obvious what all of these options are so here’s a quick rundown:

  • Adds a header of the Image name above the image in the pdf file
  • Adds a header of the calibrated or pixel size above the image in the pdf file
  • Scales (up and down) so that the image takes up the whole page
  • Includes all of the open image windows in your PDF
  • Includes all slices of all selected images in the PDF
  • Obvious, although unchecked, headers (name and size) may not be on the same page as the images
  • If checked will use 8.5×11 inches for the resulting pdf. Unchecked (for me) uses A4 dimensions (8.26×11.69 inches).
Advertisements

Comment!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.