-
1. Re: how to generate a csv report to determine paper size in a pdf or pdf/a file ?
BKBK Jan 22, 2014 3:12 AM (in response to Vishal Rathod)Use the cfpdf tag as follows:
<cfpdf
action = "getinfo"
name = "pdf_info"
source = "C:\temp\testFile.pdf">
My Operating System is Windows. This tag gets information about testFile.pdf, and stores it in a structure. I have given this structure the name pdf_info. This structure has the key you are interested in, namely, pageSizes.
Pdf_info.pageSizes is an array whose indices correspond to the respective page number in the PDF. You can use this to generate Comma-Separated Values (CSV) for each page.
<!--- Initialize CSV list --->
<cfset csv = "">
<!--- Add headers or first row, followed by carriage-return --->
<cfset csv = "Page,Height,Width" & chr(13)>
<cfloop from="1" to="#arrayLen(pdf_info.pageSizes)#" index="i">
<cfset row_info = i & "," & pdf_info.pageSizes[i]["height"] & "," & pdf_info.pageSizes[i]["width"] & chr(13)>
<cfset csv = csv & row_info>
</cfloop>
<!--- Output CSV --->
<cfoutput>#csv#</cfoutput>
<!--- Write CSV to file --->
<!--- <cffile action="write" file="C:\temp\output.csv" output="#csv#"> --->
Done!

