Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFML/HTML output problem in created PDF file

Status
Not open for further replies.

Dudework

Programmer
Dec 8, 2006
1
US
Why is it not outputing the direct content without the tags? I can create the pdf for the browser and create the pdf, however, the pdf shows all the html code and not the desired output. (Shows <img src="logo.gif"><p><strong>Hello.....) When I want the pdf to show the image and not the backend. Here is the code:

<cfset PDFname = "#getfile.filenum#_contact.pdf">
<cfset mydirectory = "C:\CFusionMX7\<cfheader name="Content-Type" value="pdf">
<cfscript>
// create a 'Document' object
document = CreateObject("java", "com.lowagie.text.Document");
document.init();
// get an outputstream for the PDF Writer
fileIO = CreateObject("java", "java.io.FileOutputStream");
// call the constructor, pass the location where you want
// the pdf to be created
fileIO.init("#mydirectory#");
// get a PDF Writer var
writer = CreateObject("java", "com.lowagie.text.pdf.PdfWriter");
// call the static 'getInstance' factory method
writer.getInstance(document, fileIO);
// open the document
document.open();
// create a new paragraph
paragraph = CreateObject("java", "com.lowagie.text.Paragraph");
paragraph.init("#myletter#");
// create a new chunk
//chunk = CreateObject("java", "com.lowagie.text.pdf.PdfContentUnder");
//chunk.init("#myletter#");
// create a new paragraph
// add the paragraph
document.add(paragraph);
// close the document (PDF Writer is listening and will automatically
// create the PDF for us
document.close();
</cfscript>

Please reply with any advice, Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top