Do a regular cfquery then in a cfscript block, loop through the recordset and add it to your pdf:

Example:
for (x=1; x LTE Get_detail.recordcount; x=x+1) {
section1.addCell(createObject("java", "com.lowagie.text.Paragraph").init(Get_detail.country[x], data));
}

-----Original Message-----
From: Spectrum Web [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 2:10 PM
To: CF-Talk
Subject: Re:PDF on Fly

Great explanation Seth

Do you can send anymore examples for query retrieve with iText?

Thanx once again.

> Before you start looking at this, if you have a Windows server that
> you can install software on, look into htmldoc, would be much easier
> than this(at least I think so).
>
> So, take a look here and get the library:
> http://www.lowagie.com/iText/docs.html
>
> Here's some sample code in CF utilizing Java and iText, I stripped out
> a lot of code from this or it would have been much longer(needs
> cleaning as well), all this does is put an image into a pdf and saves
> it:
>
> <CFPARAM NAME="attributes.save_as"
> DEFAULT="#my_path#\mypdf_#createUUID()#.pdf">
>
> <cfquery name="query" datasource="#app_datasource#"
> username="#app_user#" password="#app_passwd#">
> SELECT *
> FROM mytable
> </cfquery>
>
> <cfscript>
> pdfFile = createObject("java", "java.io.FileOutputStream").
> init(attributes.save_as);
> PageSize = createObject("java", "com.lowagie.text.PageSize").init();
> document = createObject("java", "com.lowagie.text.Document").
> init(PageSize.A4, 0, 0, 0, 0);
> PdfWriter = createObject("java", "com.lowagie.text.pdf.PdfWriter");
> PdfWriter.getInstance(document, pdfFile);
>
> FontFactory = createObject("java", "com.lowagie.text.FontFactory");
> Font = createObject("java", "com.lowagie.text.Font");
> BaseFont = createObject("java", "com.lowagie.text.pdf.BaseFont");
> helvetica = BaseFont.createFont("Helvetica", BaseFont.CP1252,
> BaseFont.NOT_EMBEDDED);
> regular = Font.init(helvetica, 10, Font.NORMAL);
> bold = Font.init(helvetica, 10, Font.BOLD);
> bbold = Font.init(helvetica, 14, Font.BOLD);
> newfont = FontFactory.getFont(FontFactory.HELVETICA, javacast("int",
> 10), javacast("int",5));
>
> Paragraph = createObject("java", "com.lowagie.text.Paragraph");
> Color = createObject("java", "java.awt.Color");
> Image = createObject("java", "com.lowagie.text.Image");
> Cell = createObject("java", "com.lowagie.text.Cell");
> Element = createObject("java", "com.lowagie.text.Element");
>
> document.open();
>
> section1 = createObject("java", "com.lowagie.text.Table").init(2);
>
> section1.setBorderWidth(0);
> section1.setBorder(0);
> section1.setSpacing(0);
> section1.setPadding(0);
> section1.setDefaultCellBorder(0);
> section1.setWidth(98);
>
> img = Image.getInstance(javacast("string",myimage));
> img.setAlignment(2);
> newcell1 = Cell.init(img);
> newcell1.setColspan(2);
> section1.addCell(newcell1);
>
> document.add(section1);
> document.close();
> </cfscript>
>
> -----Original Message-----
> From: Hassan Arteaga Rodriguez [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 23, 2003 5:52 PM
> To: CF-Talk
> Subject: RE: PDF on Fly
>
>
> Thanks Seth!! Colud u send me a little example?


>
> Regards,


>
> __
> MSc. Hassan Arteaga Rodríguez
> Microsoft Certified System Engineer.
> DIGI- Grupo de Desarrollo
> COPEXTEL, S.A.


>
>
  
> _____  
>
> From: Turetsky, Seth [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 23, 2003 03:40 PM
> To: CF-Talk
> Subject: RE: PDF on Fly
>
>
> didn't read the article, but i'm using the itext library in java, its
> tons
> o' fun
>
> -seth
>
> -----Original Message-----
> From: Hassan Arteaga Rodriguez [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 23, 2003 4:35 PM
> To: CF-Talk
> Subject: PDF on Fly
>
> I found article in www.sys-con.com about it with the title "PDFs on
> the Fly"
> But who know another ways?
>
>
> Regards,
>
>
> __
> MSc. Hassan Arteaga Rodríguez
> Microsoft Certified System Engineer.
> DIGI- Grupo de Desarrollo
> COPEXTEL, S.A.
  
> _____  
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to