*Convert PDF to Jpgs and add each page as media and add as a source

Writing and using plugins for Version 5 and above.
User avatar
Jane
Site Admin
Posts: 7630
Joined: 01 Nov 2002 15:00
Family Historian: V6.2
Location: Somerset, England
Contact:

Convert PDF to Jpgs and add each page as media and add as a source

Postby Jane » 09 Mar 2019 10:10

I have written a small plugin for my own use to convert the Irish Registrations and Census documents which come down as PDFs and add them as sources to a project in Family Historian.

It requires a 3rd party utility called pdftocairo.exe to be installed in a folder called c:\utils\pdftocairo it's part of the poppler suite

The pdftocairo can be downloaded from
http://www.fhug.org.uk/programs/pdftocairo.zip
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 16042
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Convert PDF to Jpgs and add each page as media and add as a source

Postby tatewise » 09 Mar 2019 11:20

Jane, I've had a quick look at the script and have a few comments.

Your description of what the Plugin does appears to be incomplete.
Whatever file is chosen it is added as Media to a Source unconditionally, unless it happens to be PDF.
Then the user has the choice of keeping it as PDF or converting to JPEG image file(s), which are similarly added.

I find it little disconcerting when a Plugin Filename and its Title are different.

In the convertPDF(...) function there is a local pWorkdir variable that is not used.
Confusingly there is a pWorkDir variable that is used a lot and confused me for a moment.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 7630
Joined: 01 Nov 2002 15:00
Family Historian: V6.2
Location: Somerset, England
Contact:

Re: Convert PDF to Jpgs and add each page as media and add as a source

Postby Jane » 09 Mar 2019 11:32

As I said this is one I wrote for my own use. I posted here to see if there was any interest in it, as it works for me, but could never go in the Plugin store as it needs additional software to do anything useful with the PDFs
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 16042
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Convert PDF to Jpgs and add each page as media and add as a source

Postby tatewise » 09 Mar 2019 14:43

I imagine the Plugin Store description, and a Plugin message box if it detects the pdftocairo app is missing, could advise the user how to install pdftocairo.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry


Return to “Plugin Discussions”

Who is online

Users browsing this forum: No registered users and 2 guests