>- see footer for list info -<
Managed to figure out the problem within 2minutes of posting this.

> png = CreateObject("java", "com.lowagie.text.Image");
> png.getInstance("C:\CFusionMX\charting\cache\#image_file#");
> document.add(png)

should be

png = CreateObject("java", "com.lowagie.text.Image");
mypng = png.getInstance("C:\CFusionMX\charting\cache\#image_file#");
document.add(mypng);

Cheers

[EMAIL PROTECTED] wrote on 19/08/2005 14:33:47:

> >- see footer for list info -<
> Hi there,
> 
> Using iText to generate PDF's from coldfusion.  I can add tables, 
> paragrpahs and such no problem.  WHen i try to add an image though i 
keep 
> getting a null pointer exception.
> 
> Has anyone else encountered this problem?
> 
> Code is:
> 
> 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
> 
> filename = "#DateFormat(now(), 'yyyy-mm-dd')# - 
> #str_display.qry_reportInfo.report_name#.pdf";
> fileIO.init("D:\Live Sites - EMU - Work On\temp_pdfgen\#filename#");
> 
> // 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();
> 
> //insert image
> png = CreateObject("java", "com.lowagie.text.Image");
> png.getInstance("C:\CFusionMX\charting\cache\#image_file#");
> document.add(png);
> 
> document.close();
> 
> 
> 
> All help much appreciated.
> 
> Cheers
> 
> James
> _______________________________________________
> 
> For details on ALL mailing lists and for joining or leaving lists, go to 

> http://list.cfdeveloper.co.uk/mailman/listinfo
> 
> --
> CFDeveloper Sponsors:-
> >- Hosting provided by www.cfmxhosting.co.uk -<
> >- Forum provided by www.fusetalk.com -<
> >- DHTML Menus provided by www.APYCOM.com -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help 
-<
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to