Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PDF generation

New Here ,
Dec 07, 2008 Dec 07, 2008
Hi,

I need to merge several existing pdf documents and add a dynamic first page and end page. The first page will contain an index of hyperlinks, linking to the other pages (sections) of the merged documents. I've been able to merge the documents but I'm struggling with creating the dynamic links on the first page for the internal navigation. Can anyone point me in the right direction?

Thanks Mark

386
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 07, 2008 Dec 07, 2008
Mark, here is a quick answer and a reference to MY frustrating problem :-)

What you described is the PDF table of contents functionality that now works in CF 8.01 (there was a bug in 8.0). You can create a table of contents by including the Table of Contents node in your ddx file:

<?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/>
<PDF source="Doc1"/>
<PDF source="Doc2"/>
</PDF>
</DDX>

This example results in a cover page (Title), a table of contents, and two PDFs (Doc1 & Doc2) concatenated into a single PDF file (Out1). Couple of key points:

1. I don't know if others have had this problem, but I've had no success storing and reading a ddx file from the server, so I generate that dynamically within <cfsavecontent variable="ddxBook">. This is actually a good thing, since I can use queries or XML functions to generate the ddx file dynamically.

2. As per the "CF Developer's Guide::Assembling PDF Documents::Using DDX to Perform Advanced Tasks::Adding a table of contents" you create input and output structs containing the filenames of docs to merge, and the destination of the merged file. Be sure to read this section; it will help.

3. You can use style references in the ddx to make your Table of Contents look like you want. (There is an example in the "Applications Examples" in the above section.) Each entry will be a bookmark name (doc title) and page number, as a hyperlink to the docs, which is what you want:

<TableOfContents maxBookmarkLevel="1" bookmarkTitle="Table of Contents" includeInTOC="false">
<Header styleReference="TOCheaderStyle"/>
<Footer styleReference="TOCFooterStyle"/>
<TableOfContentsEntryPattern applicableLevel="1" >
<StyledText>
<p font="Arial,11pt">
<_BookmarkTitle/><leader leader-pattern="dotted"/>
<_BookmarkPageCitation/>
</p>
</StyledText>
</TableOfContentsEntryPattern>
</TableOfContents>

You can specify what to use for the bookmark like this example (where the docTitle is in a query and the variable doc#qBook.currentRow# represents the filenames in an input struct):

<cfoutput query="qBook"><PDF source="doc#qBook.currentRow#" bookmarkTitle="#xmlFormat(docTitle)#" /></cfoutput>

The problem I have been having is that the page numbers are set by any PRE-EXISTING bookmarks/page numbers in the PDFs I am assembling, so no matter what I do, some PDFs keep showing up in the Table of Contents as page 1. So the pages go like this: 3,1,4,1,10,129,1,262,1,1,266,295,1,298,1, etc. The page numbers in the footers I applied in the ddx are fine, they just come out funky on the table of contents.

You can read my post in the Advanced Techniques area. If I get a resolution to this issue, I will let you know!

Hope this helps point you in the right direction.

Jim
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 08, 2008 Dec 08, 2008
LATEST
Hi Jim,

Thanks for the reply. I would prefer to use my own TOC/Index rather than the built in pdf TOC. I really want the front page to contain an intro paragraph with a series of hyperlinks underneath. These links would link to the sections or even anchor points within the other documents. The idea is create internal naviation withing the doc itself.

Thanks Mark.

P.S by the way I did not have a problem the ddx file from a relative link.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources