Created
May 7, 2021 12:08
-
-
Save bennadel/2deecd79df710794cdb84f9a72927d06 to your computer and use it in GitHub Desktop.
Using Both SrcFile And CFDocumentItem In The Same CFDocument Tag In Lucee CFML 5.3.7.47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
document | |
format = "pdf" | |
filename = "my-doc.pdf" | |
overwrite = true | |
{ | |
``` | |
<p> | |
I can haz PDF?! | |
</p> | |
``` | |
} | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
stub = "./out/doc-#createUniqueId()#"; | |
// Evaluate the CFML body that we're going to use for the PDF generation. | |
savecontent variable = "bodyContent" { | |
include "./render-body.cfm"; | |
} | |
// Save the CFML document as a static HTML document. This is what we're going to use | |
// as the "srcfile" for the CFDocument tag. | |
fileWrite( "#stub#-body.html", bodyContent ); | |
document | |
format = "pdf" | |
filename = "#stub#.pdf" | |
srcfile = "#stub#-body.html" | |
overwrite = true | |
localurl = true | |
{ | |
// Note that we can mix both "srcfile" and CFDocumentItem techniques. | |
documentItem type = "header" { | |
``` | |
<table width="100%" cellpadding="0" cellspacing="0" class="page-header"> | |
<tr> | |
<td class="page-header__left"> | |
Testing CFDocument | |
</td> | |
<td class="page-header__right"> | |
SrcFile & DocumentItem(s) | |
</td> | |
</tr> | |
</table> | |
``` | |
} | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment