1 Reply Latest reply on Jun 4, 2009 9:53 AM by ehaemmerle

    CFPDF, DDX, Table of Contents

    ehaemmerle Level 1

      OK so I'm trying to do a simple test using DDX to generate a table of contents. I am using  some sample code I found that is as basic as you get just to get it to work and then modify it. No matter what I try though, my Table of Contents is empty or I should say the Table of Contents page doesn't get created at all. Has anyone seen this before?


      My DDX FILE



      <?xml version="1.0" encoding="UTF-8"?>
      <DDX xmlns="http://ns.adobe.com/DDX/1.0/"
         xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
         <PDF result="Out1">
            <TableOfContents />
            <PDF source="Doc1"/>
            <PDF source="Doc2"/>


      My test file



      <cfset ddxfile = "toc.ddx">
      <cfset sourcefile1 = "c:\20225230_ESS.pdf">
      <cfset sourcefile2 = "c:\20225230_MS.pdf">
      <cfset destinationfile = "c:\foo.pdf">

      <cfset inputStruct=StructNew()>
      <cfset inputStruct.Doc1="#sourcefile1#">
      <cfset inputStruct.Doc2="#sourcefile2#">

      <cfset outputStruct=StructNew()>
      <cfset outputStruct.Out1="#destinationfile#">

      <cfpdf action="processddx" ddxfile="#ddxfile#" inputfiles="#inputStruct#" outputfiles="#outputStruct#" name="ddxVar">

      <cfdump var="#ddxvar#">

        • 1. Re: CFPDF, DDX, Table of Contents
          ehaemmerle Level 1

          Well I didn't get any help on this one, but I did figure out what was going on for anyone else having this same issue. It turns out that in order to use a "Table of Contents" your PDF pages must have bookmarks for each section you want included in the TOC. So if you were creating your PDF's from scratch using CFDOCUMENT, you would need to do this:


          <cfdocument format="pdf" filename="foo.pdf" overwrite="true" bookmark="true">
          <cfdocumentsection name="Section 1">
          <h2>Section 1</h2>


          BLAH BLAH BLAH


          Notice that bookmark is set to true and there is a cfdocumentsection surrounding the entire doc. Now obviously you can have multiple sections in your PDF which would show up as separate pages in your PDF and separate entries in the TOC. The name you give to the document section is what shows up as the entry in the TOC.



          SOOO this does answer problem 1, now does anyone know how I can get the TOC to work for PDF's I DID NOT create manually with CFDOCUMENT like ones that are already sitting on my system created by some other means that most likely do not have bookmarks? How can I include these other pdfs in the TOC? Is there a way to add bookmarks to already created PDF's?