Convert PDF to image format

I am working on an document management project that needs to run cross platform.

One of the features is to be able to:

[1] Insert a PDF into a container field then split into individual Pages (using the base elements plugin).

[2] Print individual Pages from FileMaker at ~90 % with some project text overlaid.

I'm running into a number of issues on the Windows platform as follows:

  • When I insert a PDF on the Windows platform the getContainerAttribute function does not give me the height and the width (as apposed to what it does on the Macintosh platform.)

  • On the Windows platform the PDF does not display as an image unless I click the radio button for interactive containers. On the Macintosh it's just the opposite. This makes a cross-platform implementation more difficult.

image

  • On the Windows platform when I click the radio button interactive containers in order to get the PDF to display scroll bars appear and I don't see any way to get rid of them.

I have tried importing the one page PDF using the
[1] Insert PDF script step
[2] Insert Picture script step.

The computer that I was testing on is running Windows 10 and has a full version of Adobe Acrobat installed.

It might be that the Adobe Acrobat is producing some unexpected results by virtue of being the primary PDF rendering engine?

While I know that the scroll bars appeared in the browse mode, I forgot to test if they also appear in the preview mode. My guess is yes.

Looks like the way forward is to convert the PDF to an image format of the same width and height as well as enough ppi to look and print nice.

Best way to convert a PDF to a JPEG or PNG?

References:
https://fmhelp.filemaker.com/help/15/fmp/en/index.html#page/FMP_Help/pdf-in-container.htm

FileMaker can't give you the width and height, because it can't make a preview picture.
Adobe Reader is only used to view it in an interactive container.

You can however switch to a Mac computer (as robot with FMP or as server to do it).

Otherwise you can use MBS FileMaker Plugin + DynaPDF Pro to render previews of PDF pages on Windows. See DynaPDF.GeneratePreview function.

3 Likes

I'm working on the same project. I tested it in preview mode and the container field appears completely blank for a PDF file. JPG file looks fine, no scroll bars.

2 Likes

Still searching for an economical way to convert a PDF that is in a container field to an image format...

We use the MBS FileMaker Plugin which is great.

The DynaPDF Pro looks to be very powerful. It is also outside of the project budget at the moment.

Here are 3 other possibilities that we are looking at:

[1] python - Get a preview JPEG of a PDF on Windows? - Stack Overflow

The approach with the most votes seems to require installing GhostScript and calling it from the command line. Might be:

  1. Export file
  2. Write shell script to disk
  3. Execute shell script to create .png
  4. Import .png

[2] IExtractImage (shobjidl_core.h) - Win32 apps | Microsoft Docs

This one does not look as good as the [1] above

[3] StorageFile.GetThumbnailAsync Method (Windows.Storage) - Windows UWP applications | Microsoft Docs

This one looks promising as there is a JavaScript example. That said “You must have a StorageFile object (storageFile in the example) that represents your file in order to use one of the StorageFile.GetThumbnailAsync methods.” make this one look more complicated that [1] above

Other ideas welcome!

GhostScript is expensive to license.

If Microsoft has an API for previews, I could add a function for that to the plugin.
But for PDF rendering, you may need a PDF library and DynaPDF is available.

PS: Feel free to email me and let me know what you need. Maybe I can help with a little discount.

1 Like