Skip to main content
Jun 5, 2012 10:04 PM UTC
Question

cfdocumentsection breaking css in pdf

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 is closed to new replies. Start a new post to keep the conversation going.

    5 replies

    Participant
    Jul 30, 2018 9:05 PM UTC

    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.

    Translate
    WolfShade
    Legend
    Jun 6, 2012 12:34 PM UTC

    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.

    ^_^

    Translate
    Jun 6, 2012 2:16 PM UTC

    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.

    Translate
    Sreeindia
    Participating Frequently
    Jun 6, 2012 7:54 AM UTC

    Hi

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

    Regards

    Sreekar

    Translate
    Jun 6, 2012 2:13 PM UTC

    <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>

    Translate