• Best Wishes to all for a Wonderful, Joyous & Beautiful Holiday Season, and a Joyful New Year!

Redistill PDFs?

chevalier

Well-known member
This is perhaps a question that only Dov might able to answer.

I receive a lot of different types of files from all kinds of creative software. I get a lot of PDFs that just won't normalize in my preflight workflows. Things get hung and refuse the move. If I rehash the PDF by placing in it into InDesign and export a PDF/X1a or PDF/X4 99.99999% of the time the problem goes away. I also get a fair number of DCS2 files that need to be converted to PDF for imposition/workflow purposes.

The annoyance is having to place the items in items in Illustrator or InDesign then export/save as PDF/X1a or PDF/X4. Life would be extremely easier to just dump into distiller and get a PDFX/1a or PDF/X4 out the other side.

Why can't Distiller do this?
 
On a mac, you can use the following script. Paste the code in Script Editor, click compile and save as an application. Drag one or multiple PDFs on the application icon and it will open each PDF in Acrobat to get infos about them (size, # of pages) and then place them in InDesign and export them in a folder named "Refried PDFs" on your desktop. Beware of the refrying consequenses though... But if you were OK doing it manually, this should work for you.

--Script by Colorblind, tested with Acrobat 9 and InDesign CS4
on open pdf_list
set desktop_path_hfs to the path to the desktop as string
repeat with mypdf in pdf_list
tell application "Finder"
activate
set dest_pdf_folder to desktop_path_hfs & "Refried PDFs:" as string
if not (exists dest_pdf_folder) then
make new folder with properties {name:"Refried PDFs"}
end if
set this_pdf_name to the name of mypdf
open file mypdf using application file id "CARO"
tell application "Adobe Acrobat Pro"
activate
set b to get crop box of page 1 of active doc
set w1 to item 3 of b as integer
set w0 to item 1 of b as integer
set h1 to item 2 of b as integer
set h0 to item 4 of b as integer
set PDFheight to (h1 - h0) / 72
set PDFwidth to (w1 - w0) / 72
set pagecount to count every page of active doc
set idh to PDFheight & " i" as string
set idw to PDFwidth & " i" as string
close active doc without saving
end tell


set idpage to 1
set pdfpage to 1

tell application "Adobe InDesign CS4"
activate
set mydoc to make document
tell document preferences of mydoc
set facing pages to false
set page width to idw
set page height to idh
set pages per document to pagecount

end tell
repeat pagecount times
set page number of PDF place preferences to pdfpage

-- the "crop PDF" parameter can be changed to the following: crop content/crop art/
--crop PDF/crop trim/crop bleed/crop media/crop content/crop art/¬
--crop PDF / crop trim / crop bleed / crop media

set PDF crop of PDF place preferences to crop PDF

set mypdfpage to place mypdf on page idpage of mydoc
set idpage to idpage + 1
set pdfpage to pdfpage + 1
end repeat
end tell
end tell
tell application "Adobe InDesign CS4"
activate
set my_final_destination to dest_pdf_folder
tell document preferences of document 1
set pwn to get page width
set phn to get page height
end tell
tell document 1
-- You can change "High Quality Print" to any other PDF preset
export format PDF type to my_final_destination & this_pdf_name using "High Quality Print" without showing options
end tell
end tell
end repeat
end open
 
Hi chevalier,

Why can't Distiller do this?

Distiller can only take PostScript and turn it into PDF.
If you're starting with PDF, you can use Acrobat to Export to PDF/X-1, 3, or 4. This is probably less invasive than the "place in InDesign and re-export PDF" route.


I get a lot of PDFs that just won't normalize in my preflight workflows. Things get hung and refuse the move.

It's reasonable to expect the occasional unusual file to have issues, but if this happens for you frequently... Sounds like you need a more robust preflight workflow. ;)

James
 
On a mac, you can use the following script.


Thanks Colorblind, I still use InDesign CS3 and Tiger on a PPC - sadly I get an error when executing the script (it makes the output folder but gets stuck with an error "The variable b is not defined")...I am running Acrobat 9 Pro though!

Thanks again for sharing!


Stephen Marsh
 
Stephen, do you get the PDF to open in Acrobat at all when you drop the file on the script?


Colorblind, yes, the PDF does open into Acrobat Pro 9, the "Refried PDFs" folder is also created on the Desktop - however the "The variable b is not defined" is the problem at this point of the process.

It is not a big deal so please don't sweat over it just for me (that being said, I would like to see your script work).


Regards,

Stephen Marsh
 
Stephen, it works here but do yourself a favor and open the same PDF in Acrobat Pro, paste the following code in Script Editor, make sure the "Event Log" tab is active (bottom right of the script editor window), run the script then copy what you'll get in the Event Log tab after you run it and PM it to me or post it here. It could be that the PDF doesn't have a page 1 or something else.

tell application "Adobe Acrobat Pro"
activate
try
set displayed_page to get page number of PDF Window of active doc
end try
try
set b to get crop box of page displayed_page of active doc
end try
try
set my_media to get media box of page displayed_page of active doc
end try
try
set my_trim to get trim box of page displayed_page of active doc
end try
try
set my_bleed to get bleed box of page displayed_page of active doc
end try
end tell
 
Stephen, it works here but do yourself a favor and open the same PDF in Acrobat Pro, paste the following code in Script Editor, make sure the "Event Log" tab is active (bottom right of the script editor window), run the script then copy what you'll get in the Event Log tab after you run it and PM it to me or post it here. It could be that the PDF doesn't have a page 1 or something else.end tell


Thank you for the support Colorblind!

Attached is the result.

I ran the second script separate to the first script code. Should I combine the two lots of code into one script?

Running the original script code with the PDF open in Acrobat Pro still returns the origianl error message.

As I said, this is not a big deal, so please don't go out of your way to attempt to make this work at my end if you have better things to do.


Best,

Stephen Marsh
 

Attachments

  • event-result.jpg
    event-result.jpg
    12.6 KB · Views: 212
It gets stranger, you don't get any result in the Event Log... If you could post that PDF you ran the script on, I could probably help more...
 
That is strange...I have used 3 or 5 random PDF files...all with the same result!

Perhaps if you could post the script applicaton for InDesign CS3 and Acrobat Pro 9? Perhaps I am doing something wrong when making the script?

Stephen Marsh
 
Just tried another random PDF, this one created by Illustrator and everything works!

I will send you some PDF files that failed if you like.

Thanks again Colorblind!

EDIT: If I don't open the PDF in Acrobat Pro first, I get the error (even for the above file that works).

I thought that this would use PostScript and Distiller, however it appears to use direct exporting from InDesign...so perhaps not refried?


Stephen Marsh
 
Last edited:

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top