Re: [iText-questions] Tables and new pages
Please stay on the mailing list instead of replying to me personally.. [EMAIL PROTECTED] wrote: Bruno, Cheers for getting back to me, I changed to the PdfPTable and alot of the options were gone, but it sovled the issue. Is there anyway to set the cellpadding/defaultcellborder etc like in the table object? There's a method getDefaultCell() Do something like getDefaultCell().setBorder(Rectangle.TOP); and you change the default border: br, Bruno --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions
[iText-questions] Tables and new pages
Hi all, I need some help sorting out a formatting issue when creating an pdf. Basically i'm creating a table, setting all the settings, then from a database going through each result and creating the cells to display the data. What I am doing is looping through the results, and each time adding 4 new cells to the table, which works perfectly fine, but if the results continue onto a new page, the first 2 rows or sets of cells overlap each other. Below is the code that generates the pdf document, the results are collected into an Arraylist of file objects. [code] try { PdfWriter writer = PdfWriter.GetInstance (basedoc, new FileStream(Server.MapPath() + /_files/ + IPAddress.Replace (.,) + .pdf, FileMode.Create)); writer.SetEncryption (PdfWriter.STRENGTH40BITS, null, null, PdfWriter.AllowPrinting); basedoc.Open(); Font items_font = new Font(1, 10f); basedoc.Header = new HeaderFooter(new Phrase(File Review Report - , items_font), new Phrase( : + DateTime.Now.ToShortDateString(), items_font)); Table main = new Table(4, 2); main.DefaultCellBorder = 0; main.Border = 0; main.Cellpadding = 0; main.Cellspacing = 0; main.Padding = 0; main.SetWidths(new int[4]{ 50, 300, 100, 75}); Font Header_Font = new Font(1, 20f); Font List_Font = new Font(1, 10f); Table Header = new Table(2); Header.DefaultCellBorder = 0; Header.Border = 0; Header.Cellpadding = 0; Header.Cellspacing = 0; Header.Padding = 0; Paragraph Paragraph_HDR_MainText = new Paragraph(File Review Report - + AccountName, Header_Font); Paragraph Paragraph_HDR_SmallText = new Paragraph(Created: + DateTime.Now.ToShortDateString(), List_Font); Cell Header_MainText = new Cell(); Header_MainText.Add (Paragraph_HDR_MainText); Header_MainText.Add (Paragraph_HDR_SmallText); iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance(Server.MapPath(logo.gif)); logo.ScaleToFit(45f, 45f); logo.Alignment = iTextSharp.text.Image.ALIGN_RIGHT; Cell Header_Logo = new Cell(); Header_Logo.Add(logo); Header.AddCell(Header_MainText); Header.AddCell(Header_Logo); Paragraph spacer_content = new Paragraph (s , new Font(1, 20f, 1, iTextSharp.text.Color.WHITE)); Cell spacer = new Cell(spacer_content); spacer.Colspan = 4; main.AddCell(spacer); basedoc.Add(Header); Phrase header_1_phrase = new Phrase (Barcode, List_Font); Cell header_1 = new Cell (header_1_phrase); Phrase header_2_phrase = new Phrase (Reference, List_Font); Cell header_2 = new Cell (header_2_phrase); Phrase header_3_phrase = new Phrase (Holder, List_Font); Cell header_3 = new Cell (header_3_phrase); Phrase header_4_phrase = new Phrase (Review Date, List_Font); Cell header_4 = new Cell (header_4_phrase); main.AddCell(header_1); main.AddCell(header_2); main.AddCell(header_3); main.AddCell(header_4); Paragraph spacer_content1 = new Paragraph(s , new Font(1, 5f, 1,
RE: [iText-questions] Tables and new pages
Use a PdfPTable. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gavin Sent: Tuesday, January 17, 2006 1:34 PM To: itext-questions@lists.sourceforge.net Subject: [iText-questions] Tables and new pages Hi all, I need some help sorting out a formatting issue when creating an pdf. Basically i'm creating a table, setting all the settings, then from a database going through each result and creating the cells to display the data. What I am doing is looping through the results, and each time adding 4 new cells to the table, which works perfectly fine, but if the results continue onto a new page, the first 2 rows or sets of cells overlap each other. Below is the code that generates the pdf document, the results are collected into an Arraylist of file objects. [code] try { PdfWriter writer = PdfWriter.GetInstance (basedoc, new FileStream(Server.MapPath() + /_files/ + IPAddress.Replace (.,) + .pdf, FileMode.Create)); writer.SetEncryption (PdfWriter.STRENGTH40BITS, null, null, PdfWriter.AllowPrinting); basedoc.Open(); Font items_font = new Font(1, 10f); basedoc.Header = new HeaderFooter(new Phrase(File Review Report - , items_font), new Phrase( : + DateTime.Now.ToShortDateString(), items_font)); Table main = new Table(4, 2); main.DefaultCellBorder = 0; main.Border = 0; main.Cellpadding = 0; main.Cellspacing = 0; main.Padding = 0; main.SetWidths(new int[4]{ 50, 300, 100, 75}); Font Header_Font = new Font(1, 20f); Font List_Font = new Font(1, 10f); Table Header = new Table(2); Header.DefaultCellBorder = 0; Header.Border = 0; Header.Cellpadding = 0; Header.Cellspacing = 0; Header.Padding = 0; Paragraph Paragraph_HDR_MainText = new Paragraph(File Review Report - + AccountName, Header_Font); Paragraph Paragraph_HDR_SmallText = new Paragraph(Created: + DateTime.Now.ToShortDateString(), List_Font); Cell Header_MainText = new Cell(); Header_MainText.Add (Paragraph_HDR_MainText); Header_MainText.Add (Paragraph_HDR_SmallText); iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance(Server.MapPath(logo.gif)); logo.ScaleToFit(45f, 45f); logo.Alignment = iTextSharp.text.Image.ALIGN_RIGHT; Cell Header_Logo = new Cell(); Header_Logo.Add(logo); Header.AddCell(Header_MainText); Header.AddCell(Header_Logo); Paragraph spacer_content = new Paragraph (s , new Font(1, 20f, 1, iTextSharp.text.Color.WHITE)); Cell spacer = new Cell(spacer_content); spacer.Colspan = 4; main.AddCell(spacer); basedoc.Add(Header); Phrase header_1_phrase = new Phrase (Barcode, List_Font); Cell header_1 = new Cell (header_1_phrase); Phrase header_2_phrase = new Phrase (Reference, List_Font); Cell header_2 = new Cell (header_2_phrase); Phrase header_3_phrase = new Phrase (Holder, List_Font); Cell header_3 = new Cell (header_3_phrase); Phrase header_4_phrase = new Phrase (Review Date, List_Font); Cell header_4 = new Cell (header_4_phrase); main.AddCell(header_1
Re: [iText-questions] Tables and new pages
Gavin wrote: Hi all, I need some help sorting out a formatting issue when creating an pdf. Basically i'm creating a table, setting all the settings, then from a database going through each result and creating the cells to display the data. What I am doing is looping through the results, and each time adding 4 new cells to the table, which works perfectly fine, but if the results continue onto a new page, the first 2 rows or sets of cells overlap each other. Are you using iText 1.3.6? If not, please do an upgrade and tell us if the problem persists. If you can't upgrade: please don't use class Table, use PdfPTable instead. br, Bruno --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnkkid=103432bid=230486dat=121642 ___ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions