Write Images & Rename


#1

Hi there,

I’m pretty new to Retrobatch. I have a bunch of PDFs and I would like to extract the first page of each file, scale the page to a specific size and save the new image as a GIF file.

Here is my workflow:

All is working fine except the file name of the generated GIF.

I want:

packaging.pdf -> packaging.gif
approvals.pdf -> approvals.gif

I have:

packaging.pdf -> packaging page 1.gif
approvals.pdf -> approvals page 1.gif

How can I get rid of the PDF page number?

TIA


Cary


#2

This is a little tricky, but possible. First, add a JavaScript node before the write images node. Then delete all the boilerplate code and paste the following in:

function processAsset(document, jsnode, asset) {
    var s = asset.outputFileName().replace(" page 1.", ".")
    asset.setOutputFileName(s);
    
    return true;
}

That little snippet of code removes the page 1 bit, and then sets the output file name to the new string.


#3

Thank you very much for your help @ccgus! This is just perfect! :+1: