failed: DDXM_S18005: An error occurred in the PrepareTOC phase while building <TableOfContents>.
When using DDX to merge certain pdf files, we get the following error:
failed: DDXM_S18005: An error occurred in the PrepareTOC phase while building <TableOfContents>. Cause given.
We are running Coldfusion 9.0.1 on a Windows Server 2008 R2 64-bit server.
The error occurs only on certain pdf files, and only if we include them in the table of contents.
There was a similar bug in Coldfusion 8 that was fixed, but it looks like it's come back again in Coldfusion 9.
merge.cfm:
<CFLOOP LIST="merge_no_toc.ddx,merge_toc.ddx" INDEX="ddx">
<CFLOOP LIST="good.pdf,bad.pdf" INDEX="pdf">
<CFSET inputStruct = StructNew()>
<CFSET StructInsert(inputStruct, "In1", pdf)>
<CFSET StructInsert(inputStruct, "In2", pdf)>
<CFSET outputStruct = StructNew()>
<CFSET outputStruct.Out1 = "merged.pdf">
<CFPDF ACTION="processddx" DDXFILE="#ddx#" INPUTFILES="#inputStruct#" OUTPUTFILES="#outputStruct#" NAME="merge"></CFPDF>
<CFOUTPUT>#DDX# with #pdf#:</CFOUTPUT>
<CFDUMP VAR="#merge#">
<BR />
</CFLOOP>
</CFLOOP>
merge_toc.ddx
<?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">
<TableOfContents bookmarkTitle="Table Of Contents" maxBookmarkLevel="1" includeInTOC="false">
<Header>
<Center>
<StyledText>
<p color="black" font-size="16pt">Table of Contents</p>
<p />
<p />
</StyledText>
</Center>
</Header>
</TableOfContents>
<PDF source="In1" bookmarkTitle="1" includeInTOC="true">
<PageLabel mode="Define" start="_PageNumber"/>
</PDF>
<PDF source="In2" bookmarkTitle="2" includeInTOC="true">
<PageLabel mode="Define" start="_PageNumber"/>
</PDF>
</PDF>
</DDX>
merge_no_toc.ddx
<?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">
<TableOfContents bookmarkTitle="Table Of Contents" maxBookmarkLevel="1" includeInTOC="false">
<Header>
<Center>
<StyledText>
<p color="black" font-size="16pt">Table of Contents</p>
<p />
<p />
</StyledText>
</Center>
</Header>
</TableOfContents>
<PDF source="In1" bookmarkTitle="1" includeInTOC="false">
<PageLabel mode="Define" start="_PageNumber"/>
</PDF>
<PDF source="In2" bookmarkTitle="2" includeInTOC="false">
<PageLabel mode="Define" start="_PageNumber"/>
</PDF>
</PDF>
</DDX>
The resulting output:

The "bad" pdf is a perfectly normal PDF with the Helvetica font (this is what the copier does).

The "good" pdf is a perfectly normal PDF from a different copier, without the Helvetica font.

The fonts available, as listed by the ColdFusion Administration page, include ArialMT and Helvetica:

The good and bad pdf files, as well as the ddx and cfm files can be downloaded here if you want to run it yourself: http://dl.dropbox.com/u/55552656/merge.zip
