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">
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"
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.
I'm not sure about why it's doing what it's doing, but my team found that it was helpful to look at the XML generated when messing about with PDF's to verify it's validity.
See my other post http://forums.adobe.com/message/5670235#5670235