Cf 2021 Issue with CFPDF and Flattening
I just recently upgraded to ColdFusion 2021 from ColdFusion 2016 and I have run into an odd issue. I am populating a PDFForm with values using the CFPDFForm tag, and writing the PDF data to a variable. Later I go to write out this PDF file to disk, flattening the form, and I get an error.
<cfpdf action="write" source="PDFFormVariableName" destination="#pathToWritePDF#" flatten="yes" overwrite="true">
With this code, I get an error:
Error: Variables written as a file by specifying destination in a tag cannot be used again.
coldfusion.pdf.core.PDFException$PDFInvalidDocumentVariableException: An error occurred while reading source for the cfpdf tag. at coldfusion.pdf.PDFDocHandler.readInternal(PDFDocHandler.java:324) at coldfusion.pdf.PDFDocOperation.write(PDFDocOperation.java:427) at coldfusion.pdf.PDFDocOperation.write(PDFDocOperation.java:469) at coldfusion.tagext.pdf.PDFTag.doEndTag(PDFTag.java:1963) at ....
If I change the code to write the PDF variable to disk, then load that file and flatten it, it works fine.
<cfpdf action="write" source="PDFFormVariableName" destination="#pathToWritePDF#" overwrite="true">
<cfpdf action="write" source="#formpath##outfile1#" destination="#pathToWritePDF#" flatten="yes" overwrite="true">
So there is no issue with the actual PDF file. but now I have to write it to disk, read it from disk, flatten it and re-write it back to disk. Versus onely writing to disk once.
I did try doing the source as a variable, flatten with a distination of the same or different variable, with the same result. Everything I have tried seems to show that I can not FLATTEN when the source is a PDF variable.
The original Code worked fine in ColdFusion 2016 and 2018. I do not have any other server at my disposal to test this on. The server is ColdFusion 2021 Enterprise Edition with Update 4 installed. The update was done this past week, CF 2016 was completely removed from the machine, and did a clean install of CF 2021. I think that this needs to be submitted to Adobe as a bug, but I am not sure the process for that.
I am open to suggestions on anything I might have missed or how to get this submitted to Adobe as a bug.
Matthew
