I have a page that first generates a PDF using cfdocument:
<cfdocument name="doc1" format="PDF" marginbottom="1" >
After this, I am merging this with other PDF files:
<cfpdf action="merge" name="outputpdf">
<cfpdfparam source="doc1">
<cfpdfparam source="#absolutemaindir#\patdocs\#fname#">
</cfpdf>
I am then optimizing the result:
<cfpdf action="optimize" source="outputpdf" pages="*" algo="Nearest_Neighbour"
name="optimized" nobookmarks nothumbnails nometadata nofonts>
Then finally, I am either outputing this to the screen:
<cfcontent type="application/pdf" variable="#tobinary(optimized)#" >
or I am protecting the result:
<cfpdf encrypt="AES_128" action="protect" password="#oldpw#" source="optimized"
newuserpassword="#newpw#" permissions="allowprinting">
Randomly, I am getting PDFDocException errors: Opetation(sic) could not be completed. Cause: PDFDocException.
These PDF's are being generated for different patients. Some patients it happens, others it does not. I have not been able to determine a difference between the patient's information that would be causing this.
If ColdFusion was not creating PDF files with embedded images that were 20 times larger than the sum of the file sizes, then I wouldn't have to optimize and I wouldn't be getting these errors.