Search code examples
pdfcoldfusionadobeddx

How do I change the font for the table of contents in a PDF generated with DDX file?


I'm using ColdFusion to generate a PDF and creating a DDX file that will generate the TOC for the file when it's done. I can configure and format a header for the TOC page, but have not been able to find anything anywhere on how to change the font of the actual, generated TOC.

Here's my DDX file code:

<cfsavecontent variable="ddxFile"><?xml version="1.0" encoding="UTF-8"?> 
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd"> 
    <PDF result="Out1">
        <PDF source="Title"/>       
        <TableOfContents> 
            <Header styleReference="TOCheaderStyle"/> 
        </TableOfContents> 
        <PDF source="Doc1"/>
    </PDF> 
    
    <StyleProfile name="TOCheaderStyle"> 
        <Header> 
            <Center> 
                <StyledText> 
                    <p font-weight="bold" font="Arial">Table of Contents</p> 
                </StyledText> 
            </Center> 
        </Header>       
    </StyleProfile>    
</DDX>  
</cfsavecontent>

I have been searching for an answer for about a week now with no luck on how to get to actual font setting of the generated table of contents text.

Any help would be greatly appreciated! Thanks!


Solution

  • Here's the code I'm generating thanks to the link provided by SOS:

    <cfsavecontent variable="myDDX">
    <DDX xmlns="http://ns.adobe.com/DDX/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
        <PDF result="Out1">
        <TableOfContents includeInTOC="false" bookmarkTitle="Table of Contents">
            <TableOfContentsEntryPattern applicableLevel="all" >
                <StyledText>
                    <p font-family="Times New Roman" font-size="12pt">
                        <_BookmarkTitle/>
                        <Space/>
                        <Space/>
                        <leader leader-pattern="dotted"/>
                        <Space/>
                        <Space/>
                        <_BookmarkPageCitation/>
                    </p>
                </StyledText>
            </TableOfContentsEntryPattern>
        </TableOfContents>
        <PDFGroup>
            <PDF source="Doc1" />
            <PDF source="Doc2" />
        </PDFGroup>
        </PDF>
    </DDX>
    </cfsavecontent>
    <cfif IsDDX(#myDDX#)>
        <cfset inputStruct = StructNew()>
        <cfset inputStruct.Doc1 = "FirstDocument.pdf">
        <cfset inputStruct.Doc2 = "SecondDocument.pdf">
        <cfset outputStruct = StructNew()>
        <cfset outputStruct.Out1 = "CombinedDocument.pdf">
        <cfpdf action="processddx" ddxfile="#myddx#" inputfiles="#inputStruct#" outputfiles="#outputStruct#" name="ddxVar">
        <cfdump var="#ddxVar#">
    <cfelse>
        <cfoutput><p>NO, DDX IS NOT OK</p></cfoutput>
    </cfif>