For now, draw the contents of the JTable into a canvas and then draw the canvas to 
PdfTemplate, since canvas is a 'simple' object

"Paulo Soares" <[EMAIL PROTECTED]> wrote:

>It's something worth to investigate but unfortunatly the day only have so
>many hours. I'll add that to may long to-do list.
>
>Best Regards,
>Paulo Soares
>
>----- Original Message -----
>From: "Matt Benson" <[EMAIL PROTECTED]>
>To: "Paulo Soares" <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Thursday, August 15, 2002 18:11
>Subject: Re: [iText-questions] Cannot print JTable
>
>
>> Is it possible to code into PdfGraphics2D an automatic
>> conversion of a TextLayout to glyph shapes?
>>
>> -Matt
>>
>> --- Paulo Soares <[EMAIL PROTECTED]> wrote:
>> > The code is not done and I've my doubts that it can
>> > be done in the same way
>> > as it's done now. When I print from java with
>> > Distiller all the fonts and
>> > other object are converted to curves. PdfGraphics2D
>> > attempts to keep the
>> > fonts but support for TextLayout is lost. Note that
>> > if I convert a
>> > Textlayout to glyph shapes it works correctly in
>> > PdfGraphics2D.
>> >
>> > Best Regards,
>> > Paulo Soares
>> >
>> > ----- Original Message -----
>> > From: "Matt Benson" <[EMAIL PROTECTED]>
>> > To: "Paulo Soares" <[EMAIL PROTECTED]>
>> > Sent: Thursday, August 15, 2002 14:32
>> > Subject: Re: [iText-questions] Cannot print JTable
>> >
>> >
>> > > Is it a matter of the relevant code has not yet
>> > been
>> > > done, or that the PDF medium does not allow the
>> > fine
>> > > control needed to fully implement Graphics2D?
>> > >
>> > > -Matt
>> > >
>> > > --- Paulo Soares <[EMAIL PROTECTED]> wrote:
>> > > > The problem is not the printing method but the
>> > > > implementation of
>> > > > PdfGraphics2D. It only works for simple things.
>> > > >
>> > > > Best Regards,
>> > > > Paulo Soares
>> > > >
>> > > > ----- Original Message -----
>> > > > From: <[EMAIL PROTECTED]>
>> > > > To: <[EMAIL PROTECTED]>;
>> > > > <[EMAIL PROTECTED]>
>> > > > Sent: Wednesday, August 14, 2002 22:37
>> > > > Subject: RE: [iText-questions] Cannot print
>> > JTable
>> > > >
>> > > >
>> > > > I use the following method to capture applets
>> > into
>> > > > PDF:
>> > > >
>> > > > 1) create a PdfTemplate of the same size as the
>> > > > applet
>> > > > 2) call the applet's paint method, passing the
>> > > > template's graphics obj
>> > > > 3) create an iText Image using the PdfTemplate -
>> > > > Img.getInstance(template)
>> > > > 4) insert the image into the document or table
>> > cell
>> > > > using add(...)
>> > > >
>> > > > "Ken Lo" <[EMAIL PROTECTED]> wrote:
>> > > >
>> > > > >
>> > > > >Hi all,
>> > > > >
>> > > > >I trying to print a JTable to a PDF using
>> > iText. So
>> > > > far, the resulting
>> > > > PDF
>> > > > >only shows the table outlines, but not the
>> > table's
>> > > > contents. I don't
>> > > > know
>> > > > >which part of the code went wrong. Could
>> > someone
>> > > > please help me out.
>> > > > The
>> > > > >following is a sample application demonstrating
>> > the
>> > > > problems.
>> > > > >
>> > > > >import java.awt.*;
>> > > > >import java.awt.event.*;
>> > > > >import java.awt.geom.*;
>> > > > >import java.awt.print.*;
>> > > > >import java.io.FileOutputStream;
>> > > > >import java.io.IOException;
>> > > > >import javax.swing.*;
>> > > > >
>> > > > >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;
>> > > > >
>> > > > >
>> > > > >public class PrintJTable extends JFrame {
>> > > > >
>> > > > > private JTable table;
>> > > > >
>> > > > > /**
>> > > > > * Constructor for PrintJTable.
>> > > > > */
>> > > > > public PrintJTable() {
>> > > > > getContentPane().setLayout(new
>> > BorderLayout());
>> > > > > setTitle("JTable test");
>> > > > > createToolbar();
>> > > > > createTable();
>> > > > >
>> > > > > addWindowListener(new WindowAdapter() {
>> > > > > public void windowClosing(WindowEvent e)
>> > > > {System.exit(0);}
>> > > > > });
>> > > > >
>> > > > > }
>> > > > >
>> > > > > /**
>> > > > > * Create a table with some dummy data
>> > > > > */
>> > > > > private void createTable() {
>> > > > > Object[][] data ={
>> > > > > {"Mary", "Campione", "Snowboarding", new
>> > > > Integer(5),
>> > > > new
>> > > > >Boolean(false)},
>> > > > > {"Alison", "Huml", "Rowing", new Integer(3),
>> > new
>> > > > Boolean(true)},
>> > > > > {"Kathy", "Walrath", "Chasing toddlers", new
>> > > > Integer(2), new
>> > > > >Boolean(false)},
>> > > > > {"Mark", "Andrews", "Speed reading", new
>> > > > Integer(20),
>> > > > new
>> > > > >Boolean(true)},
>> > > > > {"Angela", "Lih", "Teaching high school", new
>> > > > Integer(4), new
>> > > > >Boolean(false)}
>> > > > > };
>> > > > >
>> > > > > String[] columnNames =
>> > > > > {"First Name", "Last Name", "Sport", "# of
>> > Years",
>> > > > "Vegetarian"};
>> > > > >
>> > > > > table = new JTable(data, columnNames);
>> > > > >
>> > > > > // Use a panel to contains the table and add
>> > it
>> > > > the frame
>> > > > > JPanel tPanel = new JPanel(new
>> > BorderLayout());
>> > > > > tPanel.add(table.getTableHeader(),
>> > > > BorderLayout.NORTH);
>> > > > > tPanel.add(table, BorderLayout.CENTER);
>> > > > >
>> > > > > getContentPane().add(tPanel,
>> > BorderLayout.CENTER);
>> > > > > }
>> > > > >
>> > > > > /**
>> > > > > * 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();
>> > > > > }
>> > > > > });
>> > > > >
>> > > > > JButton exitBtn = new JButton("Exit");
>> > > > > exitBtn.addActionListener(new ActionListener()
>> > {
>> > > > > public void actionPerformed(ActionEvent e) {
>> > > > > exit();
>> > > > > }
>> > > > > });
>> > > > >
>> > > > > tb.add(printBtn);
>> > > > > tb.add(exitBtn);
>> > > > >
>> > > > > 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("jTable.pdf"));
>> > > > >
>> >
>> === message truncated ===
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> HotJobs - Search Thousands of New Jobs
>> http://www.hotjobs.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
>


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.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

Reply via email to