cfpdf merge example
Here is an example to merge pages from a single source pdf file... You can download the entire example(including the source pdf and cfm) from the download button.
<cfset sourcefile = ExpandPath('source_file1.pdf')>
<cfset destfile = ExpandPath('result_file1.pdf')>
<!--- getinfo on the source file. --->
<cfpdf action=getinfo source="#sourcefile#" name="myVar">
<br><cfoutput>The total pages of the original source file = #myVar.TotalPages#</cfoutput><br><br>
<!--- perform the merge operation. merge 3 pages - 7, 10 and 11 into a single pdf file. --->
<cfpdf action=merge source="#sourcefile#" Pages="7, 10, 11" destination="#destfile#" overwrite="true">
<!--- getinfo on the result file and verify that the total number of pages is 3. --->
<cfpdf action=getinfo source="#destfile#" name="myVar">
<cfoutput>The pages in the resultant merged file = #myVar.TotalPages#</cfoutput><br><br>
<cfset destfile = ExpandPath('result_file1.pdf')>
<!--- getinfo on the source file. --->
<cfpdf action=getinfo source="#sourcefile#" name="myVar">
<br><cfoutput>The total pages of the original source file = #myVar.TotalPages#</cfoutput><br><br>
<!--- perform the merge operation. merge 3 pages - 7, 10 and 11 into a single pdf file. --->
<cfpdf action=merge source="#sourcefile#" Pages="7, 10, 11" destination="#destfile#" overwrite="true">
<!--- getinfo on the result file and verify that the total number of pages is 3. --->
<cfpdf action=getinfo source="#destfile#" name="myVar">
<cfoutput>The pages in the resultant merged file = #myVar.TotalPages#</cfoutput><br><br>

There are no comments for this entry.
[Add Comment]