-
1. Re: CF9 - display binary from database as inline PDF
Tim Cunningham-ACP Jan 14, 2013 8:45 AM (in response to WolfShade)You should be able to have it download using cfheader
<!--- USES THE VARIABLE DEFINED ABOVE TO CREATE THE PDF USING CF TAGS --->
<cfheader name="Content-Disposition" value="inline; filename=Test.pdf">
<cfdocument format="pdf">
<cfoutput>
#tobase64(myquery.PDFhtml)#
</cfoutput>
</cfdocument> -
2. Re: CF9 - display binary from database as inline PDF
WolfShade Jan 14, 2013 9:24 AM (in response to Tim Cunningham-ACP)Hi, Tim.
Thank you for your idea. I'm closer, but getting an odd result.
No matter which PDF I try to display, it's loading in the PDF plugin for the browser, but every one is nothing but one line of characters (identical for each PDF.) Looks like just a jumble of letters (upper and lower case) and numbers. No actual PDF. I've tried "toBase64()" and "binaryEncode(column,'base64')", same result. Is there something else I should be doing?
Thank you,
^_^
-
3. Re: CF9 - display binary from database as inline PDF
Tim Cunningham-ACP Jan 14, 2013 9:28 AM (in response to WolfShade)You may try cfcontent rather than cfdocument
Sent from my iPhone
-
4. Re: CF9 - display binary from database as inline PDF
Reed Powell Jan 14, 2013 9:32 AM (in response to Tim Cunningham-ACP)I think that the op was asking how to get a PDF file to render as just part of the page, not the entire document. That's not a CFCONTENT or CFHEADER solution. Just use the <embed> tag. If you're getting the PDF bits from a database record, then you're going to need to save it in a temp file first. See code below that I use to do this - it will take a file in the current web path that is named BritEdge2.pdf and embed it on the page being rendered. It assumes that it is inside the control of a cfoutput, hence the doubleing up of the has mark.
<embed src="BritEdge2.pdf##page=3&toolbar=1&navpanes=1&scrollbar=1" width="500" height="400">
hth,
-reed
-
5. Re: CF9 - display binary from database as inline PDF
WolfShade Jan 14, 2013 9:48 AM (in response to Tim Cunningham-ACP)CFCONTENT did it. Thanks, Tim!
^_^
-
6. Re: CF9 - display binary from database as inline PDF
WolfShade Jan 14, 2013 9:51 AM (in response to Reed Powell)What you say is true; I was looking to get it to embed in part of the page, and Tim's suggestion makes it take the whole page. But it is a step in the right direction. I can always use an iframe or CFDIV to access another file that will load the CFCONTENT pdf.
But I was hoping to do this without saving a temp file.
^_^
-
7. Re: CF9 - display binary from database as inline PDF
Tim Cunningham-ACP Jan 14, 2013 11:02 AM (in response to WolfShade)What I generally do is have a page called downloadPDF.cfm, that has cfheader with a value="inline etc.." and cfcontent tag which pulls the PDF data based on other info passed to the downloadPDF.cfm page. Then my download PDF link just points to that page.


