Hi, already finding great topics and people that share their knowledge here on this forum, thanks for this!
I would like to ask, can anyone help me to create a workflow to convert a .pages file to PDF and then, for example through ADOBE ACROBAT preflight to a compliant PDF/A profile?
I have a script to convert .pages files to PDF (through CloudConvert in Hazel - tag pages files with 2PDF and wait for the offsite conversion, I can share…), but I’m stuck at the next step, convert to PDF/A.
I know about droplets (have created a couple), but I wanted to ask, if there is a way to automate this and do this in background through Automator/Apple/JavaScript.
Take a look at this ghostscript solution. You can wrap this in a shell script action in Automator and AppleScript. There might be a way to do it in Javascript.
It looks readable on the dropbox web link, but if you download the pdf, the fonts are garbled…
And the terminal output:
GPL Ghostscript 9.23 (2018-03-21)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
GPL Ghostscript 9.23:
Warning: HETVSG+Arial-BoldMT cannot be embedded because of licensing restrictions
GPL Ghostscript 9.23:
Warning: YKXKRD+HelveticaNeue-Light cannot be embedded because of licensing restrictions
GPL Ghostscript 9.23:
Warning: ROGEYK+HelveticaNeue-Bold cannot be embedded because of licensing restrictions
GPL Ghostscript 9.23:
Warning: HETVSG+Arial-BoldMT cannot be embedded because of licensing restrictions
EDIT: Ok I got it working by using “-dNoOutputFonts” in the script. But I’m afraid how it will display for users that not have the fonts installed (aka Windows users for example).
So, now I have to figure out how to append this into the cloud convert script I have set up to convert .pages files to PDF.
here is the script I use to convert .pages -> PDF
set CLOUDCONVERT_APIKEY to "my_cloudconvert_API_key"
-- Get POSIX file path
set inputFilePath to POSIX path of theFile
-- Remove .pages extension.
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ".pages"
-- Add .pdf extension.
set outputFilePath to first text item of inputFilePath & ".pdf"
set AppleScript's text item delimiters to prevTIDs
set theDate to short date string of (get current date)
set theTime to time string of (get current date)
set theMessage to theDate & " " & theTime & " converting " & inputFilePath & " into " & outputFilePath
do shell script "echo \"" & theMessage & "\" >> ~/Library/Logs/Hazel-AppleScript.log"
set theCurl to do shell script "curl -L \"https://api.cloudconvert.com/convert\" -F file=@\"" & inputFilePath & "\" -F \"apikey=" & CLOUDCONVERT_APIKEY & "\" -F \"inputformat=pages\" -F \"outputformat=pdf\" -F \"input=upload\" -F \"wait=true\" -F \"download=inline\" > \"" & outputFilePath & "\""
EDIT2: I might stay on the manual preflight procedure I use now, because I think that I need to embed fonts into the PDF/A-1b document.
I wish there was a way to automate the preflight through Adobe Acrobat, but I only managed to create a droplet for PDF/A-1b conversion and leave it at the doc and I always drop the PDF files on it and it converts them
Sorry to revive this topic, but Apple has updated the Preview app to support PDF/A conversion. No scriptable syntax has been found yet, but I’m keeping my faith Will update if there are any updates on this.
Now, there is a new function in the Preview app on macOS, to convert PDFs to PDF/As, with an option to export a “linearized” version. However, I think this has not been exposed to be used with scripting. I really hope this will be integrated on the system level and in Pages, because i’m tired of using Acrobat for this
Almost a year after the last message and the Export to PDF/A option still hasn’t been exposed for scripting…What a bummer. In the EU, almost all electronic communication with the authorities has to be done with PDF/A docs (because of security and preservation of content) and it is sad that this has not been followed up with a simple scripting support patch. Hopefully macOS 13? And maybe Shortcuts support for this? Anyway, just reviving this topic so it stays relevant in case something changes.