Cfpdf merge failures using path and named variable combo

Core issue: Source Path and output to variable results in Null Pointer Exception (NPE)

Code that was working before the latest 5.3.9.x release is now broken with the included update of PDF extension. A downgrade to 5.3.8.x does not resolve the issue, manual downgrading the Extension is needed as well.

Based on quick triage tests started after ~ PDF v1.0.0.97-RC
Confirmed affected version: (updated via 5.3.9.x Lucee update)


Says you can specify:

  • a PDF variable
  • a cfdocument variable
  • a url to a PDF document
  • or the pathname to a file

Example code summary:
PASS - PDF variables merged to variable
PASS - PDF Files merged to file
PASS - Explicitly reading PDF Files and merging to variable works
FAIL - File paths merged to variable results in a failure (2 ways of writing the same thing)

<!--- generate PDFs as variables and list variables to merge works without issue --->
<cfdocument format="pdf" name="local.pdfone" >
		PDF One
<cfdocument format="pdf" name="local.pdftwo" >
		PDF Two
<cfpdf action="merge" source="local.pdfone,local.pdftwo" name="local.mergedpdf">

<!--- That scenario doesn't happen often. More often, the PDFs already exist:  --->
<cfdocument format="pdf" filename="c:/tmp/pdfone.pdf" overwrite="yes">
		PDF One
<cfdocument format="pdf" filename="c:/tmp/pdftwo.pdf" overwrite="yes">
		PDF Two

<!--- List of file paths and output to file Works without issue:  --->
<cfpdf action="merge" source="c:/tmp/pdfone.pdf,c:/tmp/pdftwo.pdf" destination="c:/tmp/mergepdfs.pdf" overwrite="yes">

<!--- Reading files and output to variable works without issue: --->
<cfpdf action="merge" name="local.mergedpdf">
	<cfpdfparam source="#fileReadBinary("c:/tmp/pdfone.pdf")#" />
	<cfpdfparam source="#fileReadBinary("c:/tmp/pdftwo.pdf")#" />

<!--- List of files and output to variable Fails with NPE: (both versions) --->
<cfpdf action="merge" source="c:/tmp/pdfone.pdf,c:/tmp/pdftwo.pdf" name="local.mergepdf">
<cfpdf action="merge" name="local.mergepdf">
	<cfpdfparam source="c:/tmp/pdfone.pdf" />
	<cfpdfparam source="c:/tmp/pdftwo.pdf" />

Don’t forget to tell us about your stack!

OS: Windows 10 / Server - 64bit
Java Version: 11.0.x
Tomcat Version: 9.0.x
Lucee Version:
PDF version

1 Like

@Phillyun Thanks, Good bug report and sample code
I’ve filed a bug in Jira: LDEV-4010 - Regression - Cfpdf merge using path for source with name attribute throws NPE


@Phillyun This issue was solved in PDF version