Small attachments can go to the mailing list.
I run your example and it works ok. However, the problem is that it writes
the list 32 times! No wonder swing is so slow. That's why it's so large:
with the text repetition also comes along 1000 images. I suspect that it's
safer to write to a BufferedImage.
Best Regards,
Paulo Soares
----- Original Message -----
From: "Ken Lo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 15:24
Subject: Re: [iText-questions] Cannot print JTable
> You're right, that's just the main module. I attached the complete source
> code in a zip file. "JTreeTable" is a sample I found in Java Swing site.
>
> I didn't cc this to the newsgroup, because I don't know if the newsgroup
> takes any attachment. Please let me know if you have any problems
compiling
> the code.
>
> Thanks again,
> Ken
>
>
> >From: "Paulo Soares" <[EMAIL PROTECTED]>
> >To: "Ken Lo"
> ><[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
> >CC: <[EMAIL PROTECTED]>
> >Subject: Re: [iText-questions] Cannot print JTable
> >Date: Mon, 26 Aug 2002 22:09:13 +0100
> >
> >I need a complete example; I couldn't compile your code. If you are using
> >only shapes the size will always be big, using real fonts will help.
> >
> >Best Regards,
> >Paulo Soares
> >
> >----- Original Message -----
> >From: "Ken Lo" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> >Cc: <[EMAIL PROTECTED]>
> >Sent: Monday, August 26, 2002 16:33
> >Subject: Re: [iText-questions] Cannot print JTable
> >
> >
> > >
> > > Thank you for your quick responses and fixes. I know I am asking a
lot,
> > > but
> > > can I have one more request.
> > >
> > > I can print JTable using latest version of iText, but now I having
> > > problems
> > > printing the inner components within a JTable. It seems the inner
> > > components are always printed on top of its container. For example if
> > > my
> > > JTable have a JTree as its first column, the first column will
overlaps
> > > the
> > > second column when I print the table into a pdf, regardless how I set
> > > the
> > > column width. This problem can be demostrated using the swing
TreeTable
> > >
> > > example, with the following code replacing the main. Is there are a
way
> > > to
> > > enforce the column width?
> > >
> > > Also, I notice the file size of the resulting pdf is large. In my
case,
> > > it
> > > is > 500K. Is this expected?
> > >
> > > I guess I have more than one request. Thanks again for your time and
> > > efforts.
> > > Ken
> > >
> > > import java.awt.*;
> > > import java.awt.event.*;
> > > import java.awt.geom.*;
> > > import java.awt.print.*;
> > > import java.io.FileOutputStream;
> > > import java.io.IOException;
> > >
> > > import com.lowagie.text.*;
> > > import com.lowagie.text.pdf.BaseFont;
> > > import com.lowagie.text.pdf.PdfWriter;
> > > import com.lowagie.text.pdf.PdfContentByte;
> > > import com.lowagie.text.pdf.PdfTemplate;
> > >
> > > import javax.swing.*;
> > > import java.awt.event.WindowAdapter;
> > > import java.awt.event.WindowEvent;
> > >
> > > /**
> > > * TreeTable example, showing a JTreeTable, operating on the local file
> > > * system.
> > > *
> > > * @version %I% %G%
> > > *
> > > * @author Philip Milne
> > > */
> > >
> > > public class TreeTableExample0 {
> > > public static void main(String[] args) {
> > > new TreeTableExample0();
> > > }
> > >
> > > private JFrame frame = new JFrame("TreeTable");
> > > private JTreeTable treeTable = new JTreeTable(new
> > > FileSystemModel());
> > >
> > > public TreeTableExample0() {
> > >
> > > frame.addWindowListener(new WindowAdapter() {
> > > public void windowClosing(WindowEvent we) {
> > > System.exit(0);
> > > }
> > > });
> > >
> > > frame.getContentPane().setLayout(new BorderLayout());
> > > frame.getContentPane().add(new JScrollPane(treeTable),
> > > BorderLayout.CENTER);
> > > createToolbar();
> > > frame.pack();
> > > frame.show();
> > > }
> > >
> > > /**
> > > * Toolbar for print and exit
> > > */
> > > private void createToolbar() {
> > > JToolBar tb = new JToolBar();
> > >
> > > JButton printBtn = new JButton("Print");
> > > printBtn.addActionListener(new ActionListener() {
> > > public void actionPerformed(ActionEvent e) {
> > > print();
> > > }
> > > });
> > >
> > > tb.add(printBtn);
> > >
> > > frame.getContentPane().add(tb, BorderLayout.NORTH);
> > > }
> > >
> > > /**
> > > * Print the table into a PDF file
> > > */
> > > private void print() {
> > > Document document = new Document(PageSize.A4.rotate());
> > > try {
> > > PdfWriter writer =
> > > PdfWriter.getInstance(document, new
> > > FileOutputStream("jTreeTable.pdf"));
> > >
> > > document.open();
> > > PdfContentByte cb = writer.getDirectContent();
> > >
> > > // Create the graphics
> > > Graphics2D g2 = cb.createGraphics(500, 500);
> > > cb.saveState();
> > >
> > > // Print the table to the graphics
> > > Shape oldClip = g2.getClip();
> > > g2.clipRect(10, 10, 500, 500);
> > > treeTable.print(g2);
> > > g2.setClip(oldClip);
> > >
> > > cb.restoreState();
> > > g2.dispose();
> > >
> > > } catch (DocumentException de) {
> > > System.err.println(de.getMessage());
> > > } catch (IOException ioe) {
> > > System.err.println(ioe.getMessage());
> > > }
> > >
> > > document.close();
> > > }
> > > }
> > >
> > >
> > > >From: "Paulo Soares" <[EMAIL PROTECTED]>
> > > >To: "Ken Lo"
> > > ><[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
> > > >CC: <[EMAIL PROTECTED]>
> > > >Subject: Re: [iText-questions] Cannot print JTable
> > > >Date: Fri, 16 Aug 2002 19:54:04 +0100
> > > >
> > > >I modified PdfGraphics2D and the JTable now renders correctly to the
> > > pdf.
> > > >It's probably time for a new release but I'm on holidays and
uploading
> > > with
> > > >a cell phone at 9.6 kbps is too slow. Let's see if I can get
something
> > > >faster before September.
> > > >
> > > >Best Regards,
> > > >Paulo Soares
> > > >
> > > >----- Original Message -----
> > > >From: "Paulo Soares" <[EMAIL PROTECTED]>
> > > >To: "Ken Lo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> > > ><[EMAIL PROTECTED]>
> > > >Cc: <[EMAIL PROTECTED]>
> > > >Sent: Friday, August 16, 2002 16:41
> > > >Subject: Re: [iText-questions] Cannot print JTable
> > > >
> > > >
> > > > > There may be some hope ahead. I suspect that your sample is not
> > > working
> > > > > because PdfGraphics2D don't correctly support create(). I'll see
if
> > > this
> > > > > is
> > > > > enough.
> > > > >
> > > > > Best Regards,
> > > > > Paulo Soares
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Ken Lo" <[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> > > <[EMAIL PROTECTED]>
> > > > > Cc: <[EMAIL PROTECTED]>
> > > > > Sent: Friday, August 16, 2002 15:24
> > > > > Subject: Re: [iText-questions] Cannot print JTable
> > > > >
> > > > >
> > > > > >
> > > > > > Thanks for everyone's reply.
> > > > > >
> > > > > > My current work-around is to print everything into a
BufferedImage
> > > and
> > > > > > then
> > > > > > add the image into the iText document. It works, but the image
> > > > > quality
> > > > > > is
> > > > > > not that great, compared using PdfGraphics2D.
> > > > > >
> > > > > > I would like give the class canvas a try to see if this would
> > > improve
> > > > > > the
> > > > > > image quality. From what I understand from the canvas API, I
need
> > > to
> > > > > > re-implement the JTable.print() method in the canvas.paint()
> > > method.
> > > > > Is
> > > > > >
> > > > > > that right?
> > >
> > >
> > >
> > >
> > > _________________________________________________________________
> > > MSN Photos is the easiest way to share and print your photos:
> > > http://photos.msn.com/support/worldwide.aspx
>
>
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions