Create PDF's with ColdBox

265 views
Skip to first unread message

Luis Majano

unread,
Mar 5, 2012, 6:21:56 PM3/5/12
to col...@googlegroups.com
Thanks to Aaron Greenlee, we have added our last feature and last ticket to ColdBox 3.5.  You can now use renderdata to generate PDF's or distribute PDF's from binary source.  We have documented the features here:


// from binary
function pdf(event,rc,prc){
  var binary = fileReadAsBinary( file.path );
  event.renderData(data=binary,type="PDF");
}

// from content
function pdf(event,rc,prc){
  event.renderData(data=renderView("views/page"), type="PDF");
}

as you can see, you can very easily convert any view or view/layout combination into a PDF.  Not only that, but render data supports event caching, so you could easily be generating PDF's that are cached as well!


Jeff S

unread,
Apr 19, 2018, 4:46:42 PM4/19/18
to ColdBox Platform
is there a way to save the PDF Rendered on the server rather than just streaming it back to the client?

Ancient Programmer

unread,
Apr 19, 2018, 6:34:44 PM4/19/18
to ColdBox Platform
result = event.renderData(data=somedata, type="pdf");
fileWrite("foo.pdf", result.getRenderData().data);


Sweeney

unread,
Apr 19, 2018, 6:40:13 PM4/19/18
to col...@googlegroups.com
that's what i was originally looking for, but i found an alternate way by  passing in the path via pdfArgs (this writes local) and streams back

event.renderData(data=somedata, type="pdf",  pdfArgs {filename='Fullpath/blah.pdf'} );

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to a topic in the Google Groups "ColdBox Platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/coldbox/5eDHANSWDLM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to coldbox+unsubscribe@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/bc1587a0-cd27-43a1-9d10-89bfbd95183f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ancient Programmer

unread,
Apr 19, 2018, 7:59:39 PM4/19/18
to ColdBox Platform
Awesome... It's good to know.
Thanks for sharing!
To unsubscribe from this group and all its topics, send an email to coldbox+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages