Skip to main content
June 5, 2012
Question

cfdocumentsection breaking css in pdf

  • June 5, 2012
  • 3 replies
  • 1497 views

I have a 500 page document that is styled with css. The cfdocument tag is working perfectly to produce the styled text. When I add cfdocumentsections to get bookmarks, the css no longer works.

I am using CF 9,0,1,274733 Enterprise on IIS7. The content is contained in Mura.

    This topic has been closed for replies.

    3 replies

    Participant
    July 30, 2018

    I had the same issue.

    The reason you are losing the css, is because any html etc. outside of the cfdocumentsection is not included as per the documentation over here: ColdFusion Help | cfdocumentsection , where it describes the Usage. To quote the docs:

    When using cfdocumentsection, ColdFusion ignores HTML and CFML not enclosed within cfdocumentsection tags.

    In fact it seems to require that the css be included again for each cfdocumentsection. I hope this helps.

    WolfShade
    Legend
    June 6, 2012

    Are you using a .css file or have the css directly on the pages in <style> tags?  I think I read somewhere that the css needs to be imported.

    ^_^

    June 6, 2012

    I've tried the CSS embeded and using @import. It works the same in both cases. In this code, the CSS is embeded int he print_head.cfm.

    With the cfdocumentsection commented out, everything works the way I need it to work. However, I need the bookmarks.

    Sreeindia
    Participating Frequently
    June 6, 2012

    Hi

    Could you please share the code especially the one with cfdocumentsection, so that it would be helpful to reply

    Regards

    Sreekar

    June 6, 2012

    <cfdocument format="pdf" bookmark="yes" backgroundvisible="yes" fontEmbed="no" marginbottom="1" marginleft="1" marginright="1" margintop="1">

    <cfoutput>

    <cfinclude template="inc/print_head.cfm" />

    <body id="#$.getTopID()#" class="oneCol depth#arrayLen($.event('crumbdata'))#">

    <!--- Get the home page --->

    <cfset contentBean = application.contentManager.getActiveContent('00000000000000000000000000000000001', 'catalog')>

    <!--- Get the home page's kids - aka portal pages --->

    <cfset it = contentBean.getKidsIterator()>

    <cfset it.setNextN(0)>

    <!--- loop through the portal pages --->

    <cfloop condition="#it.hasNext()#">

    <!--- Get the next portal page as a contentBean --->

    <cfset portalContentBean = it.next()>

    <!--- get the portal's kids - the actual content --->

    <cfset pcbIt = portalContentBean.getKidsIterator()>

    <cfset pcbIt.setNextN(0)>

        <!--- CF Document Section Code Follows --->

        <!---<cfdocumentsection name="#portalContentBean.getTitle()#">--->

       

       

            <cfoutput>

                <h1><strong>#portalContentBean.getTitle()#</strong></h1>

            </cfoutput> 

           

            <!--- skip printing the content if we are looking at "Course Descriptions" --->

            <cfif (portalContentBean.getTitle() NEQ "Course Descriptions")>

           

                <!--- look through the content pages (children of each portal) --->

                <cfloop condition = "#pcbIt.hasNext()#">

               

                    <cfset childContentBean = pcbIt.next()>

                    <cfoutput>#childContentBean.getBody()#</br></cfoutput>

                           

                </cfloop>

               

            <cfelse>

           

                <!--- TEMPLATE CODE --->

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/coursenumbering.htm">

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/college.cfm">

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/theology.cfm">

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/evangelism.cfm">   

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/education.cfm">   

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/churchmusic.cfm">   

                <cfinclude template="#$.siteConfig('AssetPath')#/includes/custom/intcourses.cfm">   

       

            </cfif>

           

            <cfdocumentitem type="header">

                <cfoutput><span style="position: absolute; bottom: 0; right: 0;"><br />#cfdocument.currentpagenumber#</span></cfoutput>

            </cfdocumentitem>

       

        <!---</cfdocumentsection>--->

    </cfloop>

    </body>

    </html>

    </cfoutput>

    </cfdocument>