pdf function in cfscript

468 views
Skip to first unread message

Richard McKenna

unread,
Jul 16, 2015, 6:19:50 AM7/16/15
to lu...@googlegroups.com
Hi all,

I'm in the process of migrating a rather large site from Adobe CF10 to Lucee. All is going well apart from adding a header and footer to some PDFs.

I'm creating a bunch of individual PDFs then merging them together and adding a header and footer to the whole document.

To add a header in ACF I'd using the cfpdf tag like so

<cfpdf action="addheader" source="../myBook.pdf" destination="../myBookwithheader.pdf" text="Adobe" align="left">

Now it appears Lucee does not support the "text" attribute and there isn't any examples on the Lucee Tag Reference. So how do I add a header/footer to a pdf document?

Kind regards,

Richard McKenna

Richard McKenna

unread,
Jul 16, 2015, 6:21:12 AM7/16/15
to lu...@googlegroups.com
Apologies for the misleading title. I was going to ask a different question and then forgot to change the title.

Richard

Jonathan van Zuijlekom

unread,
Jul 19, 2015, 2:32:36 PM7/19/15
to lu...@googlegroups.com
For header/footer, you can use the cfdocumentitem type="footer|header"

In cfscript its something like:
<cfscript>
document format="PDF" pageType="A4" marginBottom="0.1" marginLeft="1.5" marginRight="1.5" marginTop="0.2" unit="cm" filename="test.pdf" overwrite=true {
documentitem type="header" {
include template="pdfheader.cfm";
}
documentitem type="footer" {
include template="pdffooter.cfm";
}
include template="pdfcontent.cfm";
}
</cfscript>

Railo/Lucee uses pd4ml as its pdf engine, you can use <pd4ml:***> tags in your html. More info: http://pd4ml.com/cookbook/

Jonathan van Zuijlekom

unread,
Jul 19, 2015, 2:34:34 PM7/19/15
to lu...@googlegroups.com

Richard McKenna

unread,
Jul 20, 2015, 4:31:15 AM7/20/15
to lu...@googlegroups.com
Thanks Jonathan,

It doesn't seem to allow adding a header/footer into an existing document. I already have the pdfs I just need to add the dynamic header/footer at the same time I merge them.

Kind regards,

Richard

Jochem van Dieten

unread,
Jul 20, 2015, 5:31:24 AM7/20/15
to lu...@googlegroups.com
On Mon, Jul 20, 2015 at 10:31 AM, Richard McKenna wrote:
It doesn't seem to allow adding a header/footer into an existing document. I already have the pdfs I just need to add the dynamic header/footer at the same time I merge them.

We have had quite a few issues with that and different JVMs. Since the header/footer was the same on every page we ended up just generating a separate PDF file with only the header and footer and applying that as a watermark using pdftk. This also significantly reduced the filesize and improved the quality of the images.
 
Jochem

--

Reply all
Reply to author
Forward
0 new messages