Help generating pdf file in Creator

Hi, im trying to generate a pdf file using the jar file:

itext-1.4.4.jar from the site

http://www.lowagie.com/iText/

I've created a library adding this java file, and just to see if works i pasted this code in a button on blank page:

Document doc = new Document();

ByteArrayOutputStream baosPDF = new ByteArrayOutputStream();

PdfWriter docWriter = null;

docWriter = PdfWriter.getInstance(doc, baosPDF);

doc.add(new Paragraph(

"This document was created by a class named: "

+ this.getClass().getName()));

doc.add(new Paragraph(

"This document was created on "

+ new java.util.Date()));

doc.close();

docWriter.close();

return baosPDF;

When i use fix imports, creator paste this

import com.lowagie.text.Paragraph;

import com.lowagie.text.pdf.PdfWriter;

import javax.swing.text.Document;

import java.io.ByteArrayOutputStream;

but in the page says it needs com.lowagie.text and com.lowagie.text.pdf if i put this imports manually, creator suggest me every time i put a dot that means i have correctly created the library but when i left the cursor for a while, shows a error ;

cannot find simbol

class: text

location: package Iowagie.text

but if open the package in proyect window>libraries and open the library the class is there. By the way if i use fix imports creator delete the com.lowagie.text and com.lowagie.text.pdf imports,

any suggestion or idea? if not, anyone can tell me his own xperience working with pdf and creator?

TNKS in advance!

[1626 byte] By [Beltazor] at [2007-11-26 10:05:15]
# 1
I've checked the tutorial on the site, i can now create a file in pdf, but i dont know how to display the pdf file on web browser, asumming that name file is created dynamically and the url is /opt/sun/Creator2_1/SunAppServer8/Domains/creator/configIdeas?
Beltazor at 2007-7-7 1:41:44 > top of Java-index,Development Tools,Java Tools...
# 2

Remove the Return baosPDF.

Add this code below and it shall work for you.

Kind Regards,

Roger

// setting some response headers

response.setHeader("Expires", "0");

response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");

response.setHeader("Pragma", "public");

// setting the content type

response.setContentType("application/pdf");

// the contentlength is needed for MSIE!!!

response.setContentLength(baos.size());

// write ByteArrayOutputStream to the ServletOutputStream

ServletOutputStream out = response.getOutputStream();

baos.writeTo(out);

out.flush();

Erudite at 2007-7-7 1:41:44 > top of Java-index,Development Tools,Java Tools...
# 3
my solution was to save the pdf t a known location on the harddrive, and then using a javascript call on the button onClick to open the pdf location
jbjonesjr at 2007-7-7 1:41:44 > top of Java-index,Development Tools,Java Tools...
# 4
Hi,I made a small tutorial for Java Studio Creator / iText which might be helpfull. http://www.ici-indonesia.com/tutorials/itext1/
bami at 2007-7-7 1:41:44 > top of Java-index,Development Tools,Java Tools...
# 5
Tnks for the help, i'vee solved the problem about itext and JSC2_1 tnks a lot!
Beltazor at 2007-7-7 1:41:44 > top of Java-index,Development Tools,Java Tools...
# 6

hi master

sir i have many problem for print report from my boss

i browse some data from net about JasperViewer.viewReport one give me samle as under

see code

JasperReport jasperReport = JasperCompileManager.compileReport("--Report file path-- .jrxml");

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,new HashMap(),obj);

but how i import JasperReport in my project and how i confeger that

please give me idea and setp how i call JasperViewer.viewReport in my project

thank you

aamir

mfa786 at 2007-7-7 1:41:44 > top of Java-index,Development Tools,Java Tools...