tracker issue : CF-3928680

select a category, or use search below
(searches all categories and all time range)
Title:

Cannot use HTML in cfhtmltopdfitem header/footer

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/DesignLimitation

Reporter/Name(from Bugbase): Tim Brown / Tim Brown (Tim Brown)

Created: 01/27/2015

Components: Document Management

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: ALL / Platforms All

Vote Count: 9

Problem Description: 
If you try to use HTML inside the <cfhtmltopdfitem> type of header or footer it throws an error stating an illegal element is encountered. This definitely seems like an oversight as many who would love to migrate from cfdocument to <cfhtmltopdf> would encounter this extreme limitation of not being able to output HTML in the header and footer as well as 

Steps to Reproduce:

1. Attempt to output any 

<cfset stFooter = { 
   "PrintFooterHTML" = "<h5>Some HTML for footer</h5>",
}>

<cfhtmltopdf overwrite="true" name="variables.pdfFile" destination="#variables.myDestinationPath#" margintop=".5" marginLeft=".5" marginRight=".5" >
    <h1> My Document text here</h1>
    <p>... lots of content....</p>
<cfhtmltopdfitem type="footer" attributecollection="#stFooter#">
   <div style="text-align:right; margin-bottom:10px;">
      #attributes.PrintFooterHTML#
   </div>
</cfhtmltopdfitem> 

</cfhtmltopdf>

**********************************************************************************************
ALSO you can no longer do conditionals based on normal page or last page by comparison of the current page vs total page count as you can in cfdocument
**********************************************************************************************
<cfif cfdocument.totalpagecount EQ cfdocument.currentpagenumber>
    ... different html for last page ...
<cfelse>
    ... different html for all other footers ....
</cfif>
**********************************************************************************************

**********************************************************************************************
<cfif _PAGENUMBER  EQ _LASTPAGENUMBER> 
     <img src="#attributes.lastPageFooterImg#" /> 
<cfelse> 
      <img src="#attributes.normalFooterImg#" /> etc... 
</cfif> 
**********************************************************************************************

Actual Result: 
**see attached for full stack trace **
EXCEPTION -> Message	internalProcessElement: InvalidInput: Illegal element tag "div"
StackTrace	com.adobe.internal.afml.AFMLExceptionInvalidParameter: internalProcessElement: InvalidInput: Illegal element tag "div" at com.adobe.internal.afml.AFMLAnomalies.AFMLInvalidParameterStop(AFMLAnomalies.java:76) at com.adobe.internal.pdftoolkit.services.xfatext.FormatXFAText.internalProcessElement(FormatXFAText.java:2863) at 


Expected Result:

To render the HTML in the footer or header of each page vs a monospaced font/text only option like currently the result as only basic variables can be supplied and output. This seems to be a major limitation especially since the tag has the word HTML in the name.


Any Workarounds:

I could potentially generate an image based on the dynamic html of a cfsavecontent but this still doesn't allow me to do conditional logic to supply a different image based on something to the effect of <cfif _PAGENUMBER  EQ _LASTPAGENUMBER> <img src="#attributes.lastPageFooterImg#" /> <cfelse> <img src="#attributes.normalFooterImg#" /> etc... </cfif>

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3928680

External Customer Info:
External Company:  
External Customer Name: Tim
External Customer Email:  
External Test Config: My Hardware and Environment details: Windows 2008 R2 with IIS CF 11 update 3 -> this would likely affect all platforms regardless of web server or browser.

Attachments:

  1. January 28, 2015 00:00:00: 1_cf11_cfhtmltopdfitem_bug_noHTMLAllowed.txt

Comments:

Running CF 11 with Update 3 applied which allows me to at least use variables passed in as attributes per this fixed bug (https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3744503) but the ability to do conditional logic and provide custom HTML in these cfthmltopdfitem sections is a serious limitation of this tags usefulness.
Comment by External U.
8728 | January 27, 2015 01:59:40 PM GMT
+1...been trying to figure this out for quite some time.
Vote by External U.
8764 | January 27, 2015 04:07:41 PM GMT
This is not an oversight but a limitation. As you know, CFHTMLToPDF uses acrobat engine and that engine supports a very limited set of HTML tags for header and footer. You can refer to http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf#page=664 for the list of tags supported in the body of CFHTMLToPDFITEM Tag.
Comment by Rupesh K.
8729 | January 30, 2015 10:05:29 AM GMT
Hi Rupesh and Adobe, <cfhtmltopdfitem> is essentially useless w/o support for the evalatprint attribute and support for more than these 5 HTML tags: <body>, <p>, <i>, <b> and <span>. I'm disappointed in this tag - cfhtmltopdf had so much potential. Hi Tim, I'm sorry your second question (about using cfhtmltopdf variables w/in expressions inside the cfhtmltopdfitem tag) wasn't answered. This is b/c cfhtmltopdfitem lacks the evalatprint attribute. Thanks!, -Aaron
Comment by External U.
8730 | January 31, 2015 05:49:02 AM GMT
+1 - <cfhtmltopdfitem> is essentially useless w/o support for the evalatprint attribute and support for more than these 5 HTML tags: <body>, <p>, <i>, <b> and <span>. I'm disappointed in this tag - cfhtmltopdf had so much potential.
Vote by External U.
8765 | January 31, 2015 05:49:41 AM GMT
So another wiz bang feature added, that in the long run is of no real value because it is not extended to support real use cases and already outdated. You guys really need to get out of the habit of finding new features to add, dropping it in, and walking away. From jquery to fckeditor to ZingChart to htmltopdf...cool but outdated at the time of release and no smooth upgrade path or extensibility options. If the goal is to drive everybody away from ACF so that Adobe can get rid of the product, you are on the right path.
Comment by External U.
8731 | January 31, 2015 08:15:36 AM GMT
The tag is "html to pdf" but you can't use html in the header and footer that shows up on every page?
Vote by External U.
8766 | June 04, 2015 08:50:39 AM GMT
I find the lack of full html support in cfhtmltopdf rather disappointing. So now we have two only partially implemented ways to generate PDFs.
Vote by External U.
8767 | June 05, 2015 07:55:50 AM GMT
Adobe, Just as w/ CF-3931678, this ticket here should be "Deferred/DesignLimitation" (not "Withdrawn/AsDesigned"). Losing functionality when switching from cfdocument to cfhtmltopdf should never be AsDesigned. Can this ticket please be changed to "Deferred/DesignLimitation"? Thanks!, -Aaron
Comment by External U.
8732 | December 02, 2015 02:28:47 AM GMT
Done.
Comment by Rupesh K.
8733 | December 02, 2015 02:34:56 AM GMT
Deferred until when? Yer right in the middle of the dev cycle for ColdFusion 12 *now*.
Comment by External U.
8734 | December 02, 2015 03:16:18 AM GMT
Thanks very much Rupesh! Could a ticket please be created w/ the Acrobat team to create a workaround? I think this should be done if cfhtmltopdf is positioned as an upgrade to cfdocument (same as w/ CF-3931678). Hi Adam, It sadly looks like a limitation of PDF (I went to the link in Rupesh's 1st comment). What I don't quite understand is: cfdocument was able to work around it but cfhtmltopdf seemingly can't. Thanks!, -Aaron
Comment by External U.
8735 | December 02, 2015 03:56:35 AM GMT
Hi Rupesh, Page 584 of http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf says: "Pagination artifacts: Ancillary page features such as running heads and folios (page numbers)." But nowhere does the spec say HTML support in pagination artifacts is limited to the 5 tags (body/p/i/b/span) that Rich Text Strings allow. Since this is not a PDF spec limitation, is the limitation the cf-acrobat.jar? And thus this is a valid ticket for the Acrobat team? Thanks!, -Aaron
Comment by External U.
8736 | December 02, 2015 04:55:46 AM GMT
So this ticket went from "Withdrawn/AsDesigned" to "Deferred/DesignLimitation" to "Withdrawn/ DesignLimitation". Adobe, please no, the only valid reason for "Withdrawn" would be if this a spec limitation. But this is not a spec limitation. This is either a bug in the jar provided by the Acrobat team, or it's a bug in CF's connection with it. Please reconsider this ticket and open a ticket w/ the Acrobat team (if the bug is on their end). B/c, either way, this is an Adobe-internal issue (not an external one). Thanks!, -Aaron
Comment by External U.
8737 | December 02, 2015 05:02:24 AM GMT
> This is not an oversight but a limitation. As you know, CFHTMLToPDF uses acrobat engine and that engine supports a very limited set of HTML tags for header and footer. You can refer to http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf#page=664 for the list of tags supported in the body of CFHTMLToPDFITEM Tag. Rupesh, did you raise an enhancement request on our behalf to get this tag support improved?
Comment by External U.
8738 | December 02, 2015 05:03:15 AM GMT
Aaron, you are getting confused between this bug and evalAtPrint bug. The status for this bug changed from "Withdrawn/AsDesigned" to "Withdrawn/DesignLimitation" based on your comment. Yes, we have raised it with Acrobat.
Comment by Rupesh K.
8739 | December 02, 2015 05:37:46 AM GMT
Cheers Rupesh. Is there a public-facing ticket ref we can monitor?
Comment by External U.
8740 | December 02, 2015 05:45:17 AM GMT
No. Acrobat bugbase is not public.
Comment by Rupesh K.
8741 | December 02, 2015 05:51:33 AM GMT
OK, well just keep us posted I guess. Cheers again.
Comment by External U.
8742 | December 02, 2015 05:54:07 AM GMT
Hi Rupesh, Well, I actually had asked for "Deferred/DesignLimitation" (not "Withdrawn/DesignLimitation"). CF-3931678 is appropriately "Deferred" (not Withdrawn) and I was requesting the same for this ticket here. Could that be done? My bad for thinking this ticket was temporarily marked Deferred. I'd like it to become "Deferred". I think Deferred is appropriate since the issue is internally being raised with Acrobat. But public-facing "Withdrawn" doesn't reflect this. Again, could this be Deferred instead of Withdrawn? Thanks!, -Aaron
Comment by External U.
8743 | December 02, 2015 05:57:35 AM GMT
Not really dynamic pdf generation if can't use CFML and HTML including CSS fully within cfpdfdocument or cfhtmltopdf. What is the work-around until version 12? Really need this!
Comment by External U.
8744 | December 14, 2015 02:49:46 PM GMT
Hi David, I agree. Adding a vote may increase the priority of this ticket. Thanks!, -Aaron
Comment by External U.
8745 | December 14, 2015 06:34:51 PM GMT
Hi all, Just to be clear: this is not a PDF limitation. Rupesh mentions "refer to http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf#page=664 for the list of tags supported in the body of CFHTMLToPDFITEM Tag". That PDF does not actually say pagination artifacts (headers, footers, etc) are limited in their HTML support. Thanks!, -Aaron
Comment by External U.
8746 | December 14, 2015 06:56:59 PM GMT
Not really dynamic pdf generation if can't use CFML and HTML including CSS fully within cfpdfdocument or cfhtmltopdf. What is the work-around until version 12? Really need this!
Vote by External U.
8768 | December 14, 2015 07:13:52 PM GMT
Again as Aaron Requested, why is this WITHDRAWN since it's being raised with the Acrobat team? This definitely needs to be addressed. Very limiting... per @Aaron - "I think Deferred is appropriate since the issue is internally being raised with Acrobat. But public-facing "Withdrawn" doesn't reflect this. Again, could this be Deferred instead of Withdrawn?"
Comment by External U.
8747 | February 19, 2016 12:38:51 PM GMT
I need this to work............
Vote by External U.
8769 | February 19, 2016 12:40:26 PM GMT
This is still not working. Please fix ASAP. With that said I don't think Adobe pays attention to anything written here so my vote will remain useless.
Vote by External U.
8770 | October 26, 2016 02:27:45 PM GMT
This is the nail to the coffin which I am currently lying in. Thank you so much.
Comment by External U.
8748 | November 01, 2016 09:01:14 AM GMT
Hi Adobe, This ticket was filed nearly 2 years ago. cfdocument supports HTML in header/footer. cfhtmltopdf currently does not. You are Adobe. You know PDF. You should be able to make this work. Again, it worked w/ cfdocument. So what is the issue? The link you referenced discusses rich text strings. But nowhere in that document does it say HTML in headers/footers is limited to those rich text strings. So, again, what is the issue? Thanks!, -Aaron
Comment by External U.
8749 | November 01, 2016 01:39:09 PM GMT
By "cfdocument supports HTML in header/footer. cfhtmltopdf currently does not.", I meant more than just 5 HTML tags. I don't consider that properly HTML support :)
Comment by External U.
8750 | November 01, 2016 01:44:09 PM GMT
*proper
Comment by External U.
8751 | November 01, 2016 01:44:29 PM GMT
I know this issue is pending for a long time but as mentioned earlier, we have already raised a bug with acrobat for the same. Once we get a fix from them, we will update you.
Comment by Chinoy G.
8752 | November 02, 2016 12:29:27 AM GMT
Please help to fix this. My bosses directed us to upgrade from CF9 to CF11 because CFDOCUMENT is performing slower while CFHTMLTOPDF is faster. We have so many PDF documents that need to be generated and our servers were not able to handle it as fast as we would like it to. Unfortunately after upgrading to CF11, we are finding out that CFHTMLTOPDF has a lot of limitations and unable to do this and that. I can easily "pass the buck" and say the fault is with Coldfusion, and then the Coldfusion team "passes the buck" on to the Adobe PDF team ... and on and on it goes with no real solution for this! IT IS SO UNETHICAL FOR YOU AND YOUR SALES TEAM TO HAVE ADVERTISED THAT CF11 HAS MORE SUPERIOR PDF GENERATION FEATURES BUT IT CANNOT EVEN HANDLE HTML FOOTERS??? IS THIS A JOKE?
Vote by External U.
8771 | November 02, 2016 12:53:33 AM GMT
Hi Chinoy, Thank you very much for the follow-up! Two questions: 1) Could this ticket's status please be changed from "Closed/Withdrawn/DesignLimitation" to "Closed/Deferred/ThirdParty" or "Closed/Deferred/DesignLimitation"? 2) Could you please ping the Acrobat team for a status update? Please let them know cfdocument did not have this limitation, and cfhtmltopdf is, for all intents and purposes, meant to be its successor. Thus it makes cfhtmltopdf look bad, and some existing cfdocument code cannot be ported, b/c cfhtmltopdf can't do what cfdocument could do. Thanks!, -Aaron
Comment by External U.
8753 | November 03, 2016 12:58:14 AM GMT
@Y. Lisa, regarding: "IT IS SO UNETHICAL FOR YOU AND YOUR SALES TEAM TO HAVE ADVERTISED THAT CF11 HAS MORE SUPERIOR PDF GENERATION FEATURES BUT IT CANNOT EVEN HANDLE HTML FOOTERS??? IS THIS A JOKE?". Thank you for putting into words how I feel about this too. Adobe, who is the Acrobat Team Manager that oversees the Acrobat Engine that CF is using? Thanks!, -Aaron
Comment by External U.
8754 | November 03, 2016 01:12:16 AM GMT
We got an update that this is something which will not be fixed since the behavior is as designed. As already mentioned, only five HTML tags are supported in Header/Footer content as specified here: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfhtmltopdfitem.html and here: http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf#page=664. We have also created a article listing differences in cfdocument and cfhtmltopdf present at https://helpx.adobe.com/coldfusion/kb/differences-cfdocument-cfhtmltopdf.html.
Comment by Chinoy G.
8755 | November 09, 2016 12:51:31 AM GMT
Hi Chinoy, By design? Or by limitation? Rupesh said it was by limitation, not by design. Please see Rupesh's 7:35:29 AM GMT+00:00 Jan 30, 2015 comment on this thread saying: "This is not an oversight but a limitation." That PDF does -not- say only 5 HTML tags are allowed in header/footer. Thanks!, -Aaron
Comment by External U.
8756 | November 09, 2016 08:09:37 AM GMT
Hi Chinoy, You and Rupesh referenced page 664 of that PDF, which says: ----------- Beginning with PDF 1.5, the text contents of variable text form fields, as well as markup annotations, can include formatting (style) information. These rich text strings[....] ----------- That says "form fields" and "markup annotations". That does -not- mention header/footer. So, what page mentions the 5-HTML-tag header/footer limitation? Thanks!, -Aaron
Comment by External U.
8757 | November 09, 2016 08:14:51 AM GMT
Also noting: <p> doesn't do what it should - so that's broken.
Comment by External U.
8758 | November 09, 2016 08:26:38 AM GMT
footer and header font control is key. at least have footer and header data be the same font as the PDF.
Vote by Matthew P.
8772 | February 25, 2017 09:17:18 PM GMT
Hi Adobe, Per today's ColdFusion Developer Week webinar ("PDF enhancements in ColdFusion 2016"), this ticket is still on the cards. Can you please change the State/Resolution/Reason to indicate the same? Currently it is "Closed/Withdrawn/DesignLimitation". It should at least be "Closed/Deferred/ThirdParty". (even tho the Acrobat team isn't -completely- 3rd party ;)) Thanks!, -Aaron
Comment by Aaron N.
8759 | August 03, 2017 05:28:35 PM GMT
We are checking with the internal team to see if/when they plan to address this fix. Once we have the required information, we will change the status accordingly.
Comment by Vamseekrishna N.
8760 | August 07, 2017 02:25:53 PM GMT
Hi Vamsee, Thanks very much for the follow-up. BTW, the 5-tagger PDF isn't externally viewable anymore (filed as CF-4199439). As I proved multiple times above, that PDF doesn't state Adobe's claim: that headers/footers are limited in their HTML support. Thanks!, -Aaron
Comment by Aaron N.
8761 | August 07, 2017 03:41:10 PM GMT
Basically, it's a .jar limitation; not a spec one. Thanks, -Aaron
Comment by Aaron N.
8762 | August 07, 2017 03:43:49 PM GMT
Everyone, This is the updated PDF document: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf#page=681 Thanks, Saurav
Comment by Saurav G.
8763 | August 11, 2017 05:34:17 AM GMT
Any news on this. We can not use cfdocument as it hangs when adding headers and footers to large documents. <cfpdf action="addHeader"> does not hang, but the text you can pass is so limited it is not a suitable solution.
Comment by John W.
31787 | November 07, 2019 04:58:36 PM GMT