Oh I just put the tepmplate part to notify the audience, Here is the full
block of code.

            PdfWriter writer = PdfWriter.getInstance( document, new
FileOutputStream( "jTable.pdf" ) );
            document.open();
            PdfContentByte cb = writer.getDirectContent();
            PdfTemplate map = cb.createTemplate( 1100, 1400 );
            cb.saveState();
            Graphics2D g2d = map.createGraphics( 1100, 1400, new
DefaultFontMapper() );

            Shape oldClip = g2d.getClip();
            g2d.clipRect( 0, 0, 1100, 1400);

            table.print( g2d );
            g2d.setClip( oldClip );

            g2d.dispose();
            cb.restoreState();



Bruno Lowagie (iText) wrote:
> 
> chandrajeet wrote:
>> Hi All, 
>> 
>> I have a fairly big Jtable with more than 100 columns in it. How can I
>> create a printable PDF version from it. THe current version of
>> iText(JTable2PDf) doesn't generate it right. It trims after 4 or 5th
>> column.
>> Also no headers comes in. 
>> I am afraid that I can create a PdfPTable from this big Jtable. 
>> Any improvements to JTable2Pdf. I tried with tempaltes then nothing
>> appears
>> in the PDF output. 
>> 
>> PdfContentByte cb = writer.getDirectContent(); 
>>       PdfTemplate map = cb.createTemplate(1100 , 1400); 
>>       cb.saveState(); 
>>       Graphics2D g2d = map.createGraphics(1100 , 1400, new
>> DefaultFontMapper());
> 
> This code snippet doesn't convince me you 'tried with
> templates'. Where is the rest of your code?
> br,
> Bruno
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/converting-JTable-into-pdf-format-tf3796835.html#a10743266
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to