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

Mergin around 40 PDF documents using CFPDF

Guest
Jun 27, 2012 Jun 27, 2012

Functionality :

     * Create around 40 PDF's using CFPDFFORM tag (each document is 2 pages only)

     * Merge all the files using CFPDF

Problem:

     * CFPDF  merges the document but the first (or last)  document repeated 40 times !

     * Tried flattening and merge later, flattening removes all the data populated using CFPDFFORM( i dont want flatten the file first of all)

Any help is appreciated

1.6K
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
Enthusiast ,
Jun 28, 2012 Jun 28, 2012

It would help to see your code...

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
Guest
Jul 12, 2012 Jul 12, 2012

<cfloop  query="getInfo" >

<!--- populating the PDF form and saving it in folder--->

<cfpdfform

                action="populate"

                source="E:/somedir/INCLUDES/bob.pdf" 

                destination="E://somedir/ATTACHMENTS/subfolder/#YEAR(now())/#bob_#counter#.pdf"

                overwrite = "yes">

            <cfpdfsubform name="form1">

                  <cfpdfformparam name="jacket_no" value="#getInfo.JACKET_NUMBER#">

                  <cfpdfformparam name="REQUISITION_NO" value="#getInfo.RQSTN_NUM#">

                  <cfpdfformparam name="test" value="U.S.  Agency">

                  <cfpdfformparam name="PUBLICATION_TITLE" value="#getInfo.CFR_NAME#">

                  <cfpdfformparam name="QUANTITY_Units_of_Finished_Product" value="#getBookTotals.total#">

                  <cfpdfformparam name="DATE_PREPARED" value="#DateFormat(now(), "MM/DD/YYYY")#">

            </cfpdfsubform>

      </cfpdfform>

    </cfloop>

    <!--- megring the folder --->

     <cfpdf action="merge"

                        destination="E:/somedir/attachments/sf1/bob_#YEAR(now())#.pdf"

            directory ="E:/somedir/attachments/subfolder/#YEAR(now())#" 

            order="name"

            ascending="yes"

            overwrite="yes" >

    </cfpdf>

The issue same file(first or last PDF file) repeats itself in the merged PDF , but individual PDF docuemtns inside the merged direcotry differ in data. not sure what causing it though.

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
Community Expert ,
Jul 13, 2012 Jul 13, 2012

E://somedir/ATTACHMENTS/subfolder/#YEAR(now())/#bob_#counter#.pdf"

1) Use #YEAR(now())#/ not #YEAR(now())/#

2) The variable counter doesn't seem to vary within the loop. That could lead to duplication.

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
Community Expert ,
Jun 30, 2012 Jun 30, 2012

Which cfpdf action attribute did you use? Could it be that you have placed the cfpdf merge-action in your own user-defined loop, and that the loop runs 40 times?

You could use cfpdf's directory-merge action. The following example runs on Windows. It merges all the PDFs in a given directory.

<cfpdf action = "merge"

directory = "C:\Users\BKBK\Desktop\x"

destination = "C:\Users\BKBK\Desktop\x\mergedDoc.pdf"

ascending = "yes"

keepBookmark = "yes"

overwrite = "yes">

done merging

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 ,
Apr 08, 2014 Apr 08, 2014
LATEST

I just ran into this same issue. In my case, I was using CFPDFFORM to generate populated copies of an editable PDF form provided by a third party.

When I tried to merge the resulting PDF forms into a single file (for printing), the result was fine; a multi-page PDF form with each page a copy of the original form, each page populated with different data as designed.

However, when I then tried to flatten the merged PDF using CFPDF (action="write" flatten="yes"), that's when the duplication happened. Every resulting page was a duplicate of the last form page in the merged file.

I wasn't sure if it was an issue specific to how the third party PDF form was originally created, or if it was a bug with how CFPDF handles PDF forms, but now I highly suspect it is a CFPDF bug.

In my case, the end goal is to produce a single printable PDF, so my workaround was to write/flatten each individual form page as it created, THEN merge the already flattened results.

Hope that helps. Adobe definitely has some work to do making the CFPDF and CFPDFFORM work the way we all think that it should.

David

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