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

Combine Several PDF Documents Programmatically

New Here ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

I need to combine several pdf documents programmatically within Dreamweaver/Coldfusion. Will Acrobat's SDK software Developer kit allow you to do this outside Acrobat? Is SDK just for writing Javascript within Acrobat?

If I can't use SDK to write Javascript within Dreamweaver , then how else could I combine pdf files into one pdf within Dreamweaver?

TOPICS
Advanced techniques

Views

5.3K

Translate

Translate

Report

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
Advocate ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

I'm a little confused about what you are trying to do. Are you 1) Trying to combine multiple PDF documents into 1 PDF document using coldfusion or 2) Use some sort of interface in dreamweaver to manually combine the PDF's?

If the answer is #1 - check out CFX_PDF we use it a lot and it gives you a pretty easy interface for combining multiple PDFs into 1 PDF file

If the answer is #2 - sorry, I don't have much experience in dreamweaver. Maybe someone else on the forum has some ideas.

Votes

Translate

Translate

Report

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 ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

Michael,

# 1 is the answer. I need to give the user the option to select the pdf files he/she would like to combine into 1 pdf file. I need to write the code in Coldfusion to combine several pdfs into one pdf dynamically. I then need to save the new pdf file in a certain location on our network drive.

I am reading info on the web about the CFX_pdf tag. Thank you for your reply.

Votes

Translate

Translate

Report

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
LEGEND ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

tapping wrote:
> I need to combine several pdf documents programmatically within
> Dreamweaver/Coldfusion. Will Acrobat's SDK software Developer kit allow you to

see this thread:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1114635&high...

Votes

Translate

Translate

Report

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 ,
Mar 19, 2007 Mar 19, 2007

Copy link to clipboard

Copied

Paul,

I ran the code, but received the following message. Could you give me any ideas on what to do to fix this?


Error Occurred While Processing Request
Object Instantiation Exception.
An exception occurred when instantiating a java object. The cause of this exception was that: .

The error occurred in D:\Testing WEB\trythis.cfm: line 11

9 : pdfDocument=createObject("java","com.lowagie.text.Document");
10 : // setup new PDF
11 : newPDF=createObject("java","java.io.FileOutputStream").init(finalOutPutFile);
12 : // grab existing PDFs
13 : pageOffset=0;



Votes

Translate

Translate

Report

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
LEGEND ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

tapping wrote:
> newPDF=createObject("java","java.io.FileOutputStream").init(finalOutPutFile);

what's in finalOutPutFile?

Votes

Translate

Translate

Report

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 ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Thank you Paul. A Copy of the Code is below: The output file consists of three pdfs that have form fields in them.

<cfscript>
listOfPDFs="/pdf/CompletionCertificate.pdf,/pdf/complianceagreement(secured).pdf,/pdf/privacynotice.pdf"; // list of PDFs to concatenate
finalOutPutFile="/pdf/concatenatedPDF.pdf"; // new output file
// setup needed objects
pdfCopy=createObject("java", "com.lowagie.text.pdf.PdfCopy");
pdfReader=createObject("java","com.lowagie.text.pdf.PdfReader");
pageSize=createObject("java", "com.lowagie.text.PageSize").init();
bookMark=createObject("java","com.lowagie.text.pdf.SimpleBookmark");
pdfDocument=createObject("java","com.lowagie.text.Document");
// setup new PDF
newPDF=createObject("java","java.io.FileOutputStream").init(expandPath(finalOutPutFile));

// grab existing PDFs
pageOffset=0;
PDFs=listToArray(listOfPDFs); //pdfs to copy
master=arrayNew(1); //master list
for (i=1; i LTE arrayLen(PDFs); i=i+1) {
reader=""; // clobber reader
pdfFile=expandPath(PDFs );
reader=pdfReader.init(pdfFile);
reader.consolidateNamedDestinations();
pages=reader.getNumberOfPages(); // number of pages in this PDF
bookmarks=bookMark.getBookmark(reader);
if (isDefined("bookmarks")) {
if (pageOffset NEQ 0)
bookMark.shiftPageNumbers(bookmarks, pageOffset, javacast("null",""));
arrayAppend(master,bookmarks);
} // if has bookmarks
pageOffset=pageOffset+pages;
if (i EQ 1) {
pdfDocument.init(reader.getPageSizeWithRotation(1));
pdfCopy.init(pdfDocument, newPDF);
pdfDocument.open();
} // first file in list?
// now add pages to new PDF
for (p=1; p LTE pages; p=p+1){
//page=pdfCopy.getImportedPage(reader,javacast("int",p));
//pdfCopy.addPage(page);
pdfCopy.addPage(pdfCopy.getImportedPage(reader,javacast("int",p)));

}// loop pages in this PDF
// special case: does this thing have any forms?
acroForm=reader.getAcroForm();
if (isDefined("acroForm"))
pdfCopy.copyAcroForm(reader);
} //loop PDFs
if (arraylen(master) GT 0)
pdfCopy.setOutlines(master);
pdfDocument.close(); //done & done
</cfscript>


Votes

Translate

Translate

Report

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
LEGEND ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

tapping wrote:
> newPDF=createObject("java","java.io.FileOutputStream").init(expandPath(finalOut
> PutFile));

this bit is different from what you showed earlier, does it work now that you
have an absolute path to the output file?

Votes

Translate

Translate

Report

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 ,
May 29, 2012 May 29, 2012

Copy link to clipboard

Copied

is CFX_PDF the best for cf devs?

Votes

Translate

Translate

Report

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
LEGEND ,
May 29, 2012 May 29, 2012

Copy link to clipboard

Copied

This is an old thread.  Since it was written, the cfpdf tag has been added to ColdFusion.  That's what I would use.

Votes

Translate

Translate

Report

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 ,
May 29, 2012 May 29, 2012

Copy link to clipboard

Copied

nikos101 wrote:

is CFX_PDF the best for cf devs?

Why go digging up threads that are more than 5 years old? You might as well ask your grandma.

Votes

Translate

Translate

Report

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 ,
May 30, 2012 May 30, 2012

Copy link to clipboard

Copied

LATEST

ahahahah

Votes

Translate

Translate

Report

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
Documentation