Getting the names of the input files for use in the pdf output

Hey everybody,

I’m looking for a way to ad the names of my input files into my pdfs. I’m working in the planetpress workflow. But I’m having a hard time getting to the names of the input files. I’m currently playing around with %O. %O seems to work in debug mode, but when I put the workflow configuration live, %O always seems to be empty.

Is there a way to get the names of the input files that works when you put the configuration live?

%O should work in LIVE. It must be something else you are doing in your steps that produce the issue.
Can you detail more the whole process including how you transfer the %O content to your Template?

I’d probably assign %O to a user defined workflow variable and pass it in through the method described in the link below.

I’m currently not passing anything to the template yet. I was just testing if I could get the file name I wanted using just the workflow. I’ll describe my current workflow under here.

Merge PDF Files
	|
Create Metadata
	|
Metadata level Creation
(Document :  Begin when %O value changed)
	|
Metadata fields Management
add Document;DocumentName;%O
 	|
Create Metadata
	|
Run Script:
var metadata = new ActiveXObject("MetadataLib.Metafile");
metadata.LoadFromFile(Watch.GetMetadataFileName());
var documentName = metadata.Job().Group(0).Document(0).FieldByName("DocumentName");
Watch.Log("This is: " + documentName,3);
	 |
Send to Folder

Not what I was asking for, but this is probably going to save me some time in the future so thanks anyway. :grinning:.

You second Create Metadata reset the previous one. There is your problem :wink:

Ah thanks, so that’s how I broke my documentName in debug. It still doesn’t work in in the live configuration, I’m afraid.

Have you resend you configuration? After removing the second Create Metadata.

Upon looking at your config…I think it is a logic error…

Your Metadata level Creation is triggered when %O changes…from one execution of the process to the next, the value is not “remembered”, therefore, your Metadata level Creation will never be triggered.

I resend the configuration again to make sure. Doesn’t seem to work.

So, is there a way for my proscess to remember the value so that my Metadata level creation does what it’s supposed to do. Or am I thinking in the wrong direction.

You need a loop somehow in this…Can you explain what it is you are trying to achieve?

Ok, I hope this explains what I’m trying to do.

I’m using the workflow to merge multiple pdf files. In front of the merged file I want a cover page that shows the names of each of the original files plus the amount of pages in those files, I haven’t made this page yet.

I’ve made documents in the metadata, the documents start whenever a pdf file with a new name passes through the metadata level creation. So each of the original files has a metadata document.

Then we get a loop that goes through the pdf a number of times equal to the number of documents in the metadata. It inserts a page in front each document. The page already contains the number of pages in the document, but I still need to add the original file name to each of those pages.

Here’s how i would do it:

  1. Folder Capture plugin of a trigger file (a file that you drop into a folder to trigger the whole process).

  2. A new branch
    a. Folder capture (as an Action) that grabs all PDF, to be merged, from a folder. (that is your loop)
    b. Scripts that returns you your page count (see below)

     var objPDF = Watch.GetPDFEditObject();
     objPDF.Open(Watch.GetJobFileName(), false);
     
     var objPages = objPDF.Pages();
     Watch.SetJobInfo(2, objPages.Count());
    
     objPages=null;
     CollectGarbage();
     objPDF.Close();
    

    c. A branch that use the Create File plugin
    In it you use JobInfo2 (which has your page count) and %O (which has your original file name)
    d. An Send to Folder plugin which concatenate each new file together (new file which holds PDF info). Named it myPDFInfo.CSV

  3. Folder Capture plugin (as an Action) of your myPDFInfo.CSV file

  4. Connect Datamapper of that CSV file.

  5. Connect Template which generates your first “report kind” first page.
    In it, it calls dynamically all PDF and show them. In the OutputPreset make sure you check the Passthough PDF resources. that will prevent the PDFs from being re-ripped.

That should get you started.

1 Like

Thanks, looks like I’ll be able to figure it out with this.