Hi,

Iam facing problems with printing more than two components in a PDF.

If iam trying to set the Boundaries for JTable, which does not have any
Header.

Now i set the boundaries for text which i want to display above the JTable.
Below is the code:



PdfWriter writer = PdfWriter.*getInstance*(document,

*new* FileOutputStream("PrdctJTable.pdf"));

document.open();

PdfContentByte cb = writer.getDirectContent();

PdfTemplate tp = cb.createTemplate(500, 500);

 Graphics2D g2 = tp.createGraphicsShapes(500, 500);
g2.drawString("Prod Report");
jTable.setBounds(30,130,150,120);
jTable.print(g2)
cb.addTemplate(tp, 300, 300);

g2.dispose();

No matter how i change the boundaries for jTable the text string always gets
displayed
inside jTable, which i dont want to.

Bottom Line:
1) I wanted to print my table header as "Prod Report". And below that the
jTable.

2) when i tried to set the column width for jtable, it never sets the column
width.
    For some reason it is getting the default width from jTable.

  Strange thing is:
   I set the width of the column, i call the jTable.print(g2); and then
print the column width again, i can clearly see the width which i have set.
But jTable in the PDF, width size always remains fixed, which is shrinking
the data.

Please help.

Thanks and Regards,
Kiran



On 3/5/08, jmcmahon <[EMAIL PROTECTED]> wrote:
>
>
> I am trying use the  http://www.jfree.org/eastwood/index.html Eastwood
> Chart
> Servlet , which is based off the  http://code.google.com/apis/chart/Google
> Chart Api , with iText. Essentially you send a formatted url string off to
> the servlet and it returns a .png image of the chart. This works great for
> html pages, but now I am trying embed the chart urls as images in iText
> without much success. For example:
>
>                Image img = Image.getInstance(testUrl);
>
> Where testUrl is a String or URL (I've tried both and if you look at the
> code they are essentially the same thing).
>
> This results in this error:
>
> java.io.IOException: Server returned HTTP response code: 406 for URL:
> testUrl
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(
> HttpURLConnection.java:1170)
>        at java.net.URL.openStream(URL.java:1007)
>        at com.lowagie.text.Image.getInstance(Unknown Source)
>        at com.lowagie.text.Image.getInstance(Unknown Source)
>
> That is just the top of the stack trace, as the rest is program specific.
> testUrl is a stand-in for the actual url.
> I took a look at the HTTP header with snort and it looks like this:
>
> testUrl HTTP/1.1..User-Agent: Java/1.5.0_14..Host:
> devjrun..Accept:text/html, image/gif, image/jpeg, *; q=.2,
> */*;q=.2..Proxy-Connection: keep-alive....
>
> This returns a 406 not accepted from the server with a message "Your
> request
> used a protocol that is not currently supported."
>
> Essential I've hit a wall and I have no idea about how to get this to
> work.
> Any ideas/suggestions would be greatly welcome.
>
> Thanks.
>
>
> --
> View this message in context:
> http://www.nabble.com/Using-Goolge-Chart-Api-or-Eastwood-in-iText-tp15859998p15859998.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to