One way to achieve it would be to insert the PDF width and\or height into the data file as separates data fields using the Run Script action
Imagine the following pipe delimited CSV data file where the last field on each line is the name of the PDF
Mr AB Sample1|1 Sample Lane|Sample|County Sample|AA1 1AA|UK|11x17Landscape.pdf
Mr AB Sample2|2 Sample Lane|Sample|County Sample|AA2 2AA|UK|8.5x11Portrait.pdf
Mr AB Sample3|3 Sample Lane|Sample|County Sample|AA3 3AA|UK|11x17Landscape.pdf
Mr AB Sample4|4 Sample Lane|Sample|County Sample|AA4 4AA|UK|11x17Landscape.pdf
Mr AB Sample5|5 Sample Lane|Sample|County Sample|AA5 5AA|UK|8.5x11Portrait.pdf
The below VBScript loops through each record of the CSV, gets the the PDF name, opens it and read its width and height property and finally add these two values to the end of each record.
dim objFSO, objInputFile, objOutputFile
dim myCSV, strNewLineContent, strLine, fieldsArr
dim pdfBackground, myRect, pdfWidth, pdfHeight
set pdfBackground = Watch.GetPDFEditObject
set myRect = CreateObject(“AlambicEdit.PdfRect”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
myCSV = Watch.GetJobFileName
set objInputFile = objFSO.OpenTextFile(myCSV, 1, true, 0)
strNewLineContent = “”
Do Until objInputFile.AtEndOfStream
strLine = Trim(objInputFile.Readline)
fieldsArr = Split(strLine, "|")
pdfBackground.open "E:\Tickets\157678\" & fieldsArr(UBound(fieldsArr)),false
Set myRect = pdfBackground.Pages(0).size
pdfWidth = Round((myRect.right)*0.0138889,2) 'points to inch conversion
pdfHeight = Round((myRect.top)*0.0138889,2) 'points to inch conversion
strLine = strLine & "|" & pdfWidth & "|" & pdfHeight & vbCrLf
strNewLineContent = strNewLineContent & strLine
Watch.log " pdfWidth is: " & pdfWidth & " inch" & " and pdfHeight is: " & pdfHeight & " inch.", 2
pdfBackground.close
Loop
objInputFile.Close
set objOutputFile = objFSO.OpenTextFile(myCSV, 2, true, 0)
objOutputFile.Write strNewLineContent
objOutputFile.Close
The resulting CSV looks like the below:
Mr AB Sample1|1 Sample Lane|Sample|County Sample|AA1 1AA|UK|11x17Landscape.pdf|17|11
Mr AB Sample2|2 Sample Lane|Sample|County Sample|AA2 2AA|UK|8.5x11Portrait.pdf|8.26|11.69
Mr AB Sample3|3 Sample Lane|Sample|County Sample|AA3 3AA|UK|11x17Landscape.pdf|17|11
Mr AB Sample4|4 Sample Lane|Sample|County Sample|AA4 4AA|UK|11x17Landscape.pdf|17|11
Mr AB Sample5|5 Sample Lane|Sample|County Sample|AA5 5AA|UK|8.5x11Portrait.pdf|8.26|11.69