Continue PDFtable on next page with headers - c#

this is my code:
PdfPTable tableSumme = new PdfPTable(dtUebersicht.Columns.Count-1);
widthsSumme = new float[] { 4.2f, 5f, 5f, 5f, 5f };
tableSumme.SetWidths(widthsSumme);
tableSumme.WidthPercentage = 100;
tableSumme.TotalWidth = 500f;
foreach (DataColumn c in dtUebersicht.Columns)
{
PdfPCell Spalte = new PdfPCell(new Phrase(c.ColumnName, VerdanaFont));
Spalte.HorizontalAlignment = Element.ALIGN_CENTER;
Spalte.VerticalAlignment = Element.ALIGN_MIDDLE;
tableSumme.AddCell(Spalte);
}
PdfContentByte cbSumme = writerSumme.DirectContent;
foreach (DataRow dr in dtUebersicht.Rows)
{
PdfPCell Spalte0 = new PdfPCell(new Phrase(dr[0].ToString(), VerdanaFont));
Spalte0.HorizontalAlignment = Element.ALIGN_CENTER;
Spalte0.VerticalAlignment = Element.ALIGN_MIDDLE;
PdfPCell Spalte1 = new PdfPCell(new Phrase(dr[1].ToString(), VerdanaFont));
Spalte1.HorizontalAlignment = Element.ALIGN_CENTER;
Spalte1.VerticalAlignment = Element.ALIGN_MIDDLE;
tableSumme.AddCell(Spalte0);
tableSumme.AddCell(Spalte1);
}
tableSumme.WriteSelectedRows(0, -1, 35, 757, cbSumme);
This gives me a PDF with one page and the data on it. The data is longer than the page so I want to insert every 50th row a new page. How can I solve this?
A simple
if (Rowindex % 50 == 0)
{ documentSumme.NewPage(); }
doesn't work. Thanks

Here is a small example following the comment by #Bruno Lowagie.
When the end of the page is reached before all rows are added, they will be added on the next page.
Document doc = new Document();
FileStream fs = new FileStream(#"your path", FileMode.Create, FileAccess.Write);
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
doc.Open();
List<string> columns = new List<string> {"col1", "col2", "col3", "col4", "col5"};
PdfPTable table = new PdfPTable(columns.Count);
table.SetWidths(new[] { 5f, 5f, 5f, 5f, 5f });
table.WidthPercentage = 100;
table.TotalWidth = 500f;
table.HeaderRows = 1;
foreach (string col in columns)
{
PdfPCell cell = new PdfPCell(new Phrase(col));
table.AddCell(cell);
}
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < columns.Count; j++)
{
PdfPCell cell = new PdfPCell(new Phrase($"{i},{j}"));
table.AddCell(cell);
}
}
doc.Add(table);
doc.Close();

Related

I want to increase the width of the first column in itextsharp pdf creation

I want to increase the width of the first column matricule in itextsharp pdf creation
The picture shows what I want
enter image description here
PdfPTable pdfTable = new PdfPTable(dataGridView4.ColumnCount);
//pdfTable. = 5;
pdfTable.DefaultCell.Padding = 3;
pdfTable.DefaultCell.HorizontalAlignment = 0;
pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
pdfTable.WidthPercentage = 100;
// pdfTable.SetWidths(GetHeaderWidths(font.GetFont("ARIAL", 30), headers));
pdfTable.DefaultCell.VerticalAlignment = Element.ALIGN_CENTER;
pdfTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
//pdfTa = Element.ALIGN_MIDDLE;
pdfTable.DefaultCell.BorderWidth = 1;
//pdfTable.DefaultCell.Width = 10;(
//pdfTable.TotalWidth = 300;
pdfTable.DefaultCell.UseAscender = true;
iTextSharp.text.Font fon = FontFactory.GetFont("ARIAL", 30);
foreach (DataGridViewColumn column in dataGridView4.Columns)
{
int c = 0;
PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
if (c == 0)
{
// pdfTable.SetWidths(c);
// column.HeaderText = "330";
// dataGridView4.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
// pdfTable.AddCell(cell);
}
You can custom the width using pdfptable
PdfPTable table = new PdfPTable(5); // this will be your # of columns.
table.HorizontalAlignment = 0;
table.TotalWidth = 500f;
table.LockedWidth = true;
float[] widths = new float[] { 20f, 60f, 60f, 30f, 50f };
table.SetWidths(widths);
this is what you want to concentrate on:
float[] widths = new float[] { 20f, 60f, 60f, 30f, 50f };
here is the article which may help you:
Source
another complete example:
public static void main(String[] args) {
Document doc = new Document();
try {
PdfWriter.getInstance(doc, new FileOutputStream("TableColumnWidth.pdf"));
doc.open();
PdfPTable table = new PdfPTable(4);
table.addCell(new PdfPCell(new Phrase("Cell 1")));
table.addCell(new PdfPCell(new Phrase("Cell 2")));
table.addCell(new PdfPCell(new Phrase("Cell 3")));
table.addCell(new PdfPCell(new Phrase("Cell 4")));
// Defiles the relative width of the columns
float[] columnWidths = new float[]{10f, 20f, 30f, 10f};
table.setWidths(columnWidths);
doc.add(table);
} catch (DocumentException | FileNotFoundException e) {
e.printStackTrace();
} finally {
doc.close();
}
}
source

How to print One Record Per Page With a Header for each page in PDF document with iTextSharp in C#

I am new to iTextSharp.
How can I print one record per page?
Could anyone provide me with some sample code to show me how I can achieve my objective?
Try this Solution :
using (var output = new MemoryStream())
{
using (var document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 40, 40, 30, 90))
{
using (var writer = PdfWriter.GetInstance(document, output))
{
Phrase phrase = null;
PdfPCell cell = null;
PdfPTable table = null;
try
{
document.Open();
document.PageCount = 1;
writer.PageEvent = new Footer(data);
foreach (var item in data)
{
table = new PdfPTable(1);
table.SpacingBefore = 20;
table.WidthPercentage = PageSize.A4.Width;
float[] ProfessionalServices = new float[1];
ProfessionalServices[0] = (float)(1 * PageSize.A4.Width);
table.SetWidthPercentage(ProfessionalServices, PageSize.A4);
phrase = new Phrase("Record :" + item);
cell = new PdfPCell(phrase);
cell.Border = 0;
cell.Padding = 2;
cell.Colspan = 3;
cell.HorizontalAlignment = Element.ALIGN_RIGHT;
table.AddCell(cell);
table.WriteSelectedRows(0, -1, document.Left, document.Top - (100 + 20), writer.DirectContent);
document.Add(table);
document.ResetPageCount();
document.NewPage();
}
document.Close();
}
catch (Exception ex)
{
}
if (!Directory.Exists(current.Server.MapPath("~/bill-pdf/")))
Directory.CreateDirectory(current.Server.MapPath("~/bill-pdf/"));
string pdfFilePath = current.Server.MapPath("~/bill-pdf/" + guid + ".pdf");
File.WriteAllBytes(pdfFilePath, output.ToArray());
if (File.Exists(filePath))
File.Delete(filePath);
}
}
}
Footer Method code :
#region Footer Class
public partial class Footer : PdfPageEventHelper
{
#region Constructor
public Footer()
{
}
#endregion
#region OnStartPage
public override void OnStartPage(PdfWriter writer, Document document)
{
if (document.PageNumber > 1)
{
string footerMessage = "Page " + document.PageNumber;
Paragraph footer = new Paragraph(footerMessage, FontFactory.GetFont(FontFactory.HELVETICA, 9));
footer.Alignment = Element.ALIGN_RIGHT;
PdfPTable footerTbl = new PdfPTable(numColumns: 1);
footerTbl.WidthPercentage = 100;
footerTbl.TotalWidth = PageSize.A4.Width;
PdfPCell cell = new PdfPCell(new Phrase(footer));
cell.Border = 0;
cell.HorizontalAlignment = Element.ALIGN_RIGHT;
footerTbl.AddCell(cell);
footerTbl.WriteSelectedRows(0, -1, document.RightMargin - 80, document.Top + 30, writer.DirectContent);
}
}
#endregion
#region OnEndPage
public override void OnEndPage(PdfWriter writer, Document doc)
{
string footerMessage = "Footer Text";
Paragraph footer = new Paragraph(footerMessage, FontFactory.GetFont(FontFactory.HELVETICA, 9));
footer.Alignment = Element.ALIGN_CENTER;
PdfPTable footerTbl = new PdfPTable(numColumns: 1);
footerTbl.TotalWidth = PageSize.A4.Width;
PdfPCell cell = new PdfPCell(new Phrase(footer));
cell.Border = 0;
cell.HorizontalAlignment = Element.ALIGN_CENTER;
footerTbl.AddCell(cell);
//footerTbl.WriteSelectedRows(0, 10, 50, 55, writer.DirectContent);
footerTbl.WriteSelectedRows(0, -1, 0, 55, writer.DirectContent);
}
#endregion
}
#endregion
Try code you can set header and footer your own content For header modify OnStartPage() and for footer modify OnEndPage()

Text is not even between two cells when inserting an image and text in the same cell, ITextSharp

I have table with 3 columns and one row. In cell 1 I have a phrase and in cell 2, next to the phrase I have an Image and a text.
I am able to combine the image and the text in a same cell but. The problem I have now is that the text in cell 1 is in a higher position than the text in cell 2 and I don't know why. And I need them to be even.
this is the result:
this is my code:
private void btnCrear_Click(object sender, EventArgs e)
{
Document doc = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.GetInstance(doc,
new FileStream((Application.StartupPath+"\\PSC.pdf"), FileMode.Create));
doc.AddTitle("Recibo de Pago de Derechos Laborales");
doc.AddCreator("Errol");
doc.Open();
/*Get Image and set size*/
iTextSharp.text.Image SC = iTextSharp.text.Image.GetInstance(Application.StartupPath+"\\SimboloColones.png");
SC.ScaleAbsolute(5, 8);
PdfPTable table = new PdfPTable(3);/*3 columns*/
table.TotalWidth = 588;
table.LockedWidth = true;
/*Cell 1*/
PdfPCell cell = new PdfPCell(new Phrase("Preaviso"));
cell.Colspan = 1;
cell.HorizontalAlignment = 2;
cell.BorderColor = BaseColor.BLACK;
cell.BorderWidthBottom = 0;
cell.BorderWidthTop = 0;
cell.BorderWidthRight = 0;
cell.BorderWidthLeft = 0;
table.AddCell(cell);
/*Cell 2*/
cell = new PdfPCell();
cell.Colspan = 1;
cell.HorizontalAlignment = 0;
cell.BorderColor = BaseColor.BLACK;
/*Insert Image and text into the cell*/
Phrase pPreaviso = new Phrase();
pPreaviso.Add(new Chunk(SC, 0, 0));
pPreaviso.Add(new Chunk("Cant Pre"));
cell.AddElement(pPreaviso);
table.AddCell(cell);
/*Cell 3*/
cell = new PdfPCell(new Phrase(" "));
cell.Colspan = 1;
cell.HorizontalAlignment = 1;
cell.BorderColor = BaseColor.BLACK;
cell.BorderWidthBottom = 0;
cell.BorderWidthTop = 0;
cell.BorderWidthRight = 0;
cell.BorderWidthLeft = 0;
table.AddCell(cell);
doc.Add(table);
doc.Close();
writer.Close();
System.Diagnostics.Process.Start(Application.StartupPath+"\\PSC.pdf");
}
I don't know what is wrong with the code.
Thanks in advance
Thanks to #BrunoLowagie I was able to come up with a solution. However, I also nedded the text alignment to be centered, therefore I ended up using Paragraph instead of Phrase for all the texts in the cells.
This is the final result:
And, this is the code that ended up working for me:
private void btnCrear_Click(object sender, EventArgs e)
{
Document doc = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.GetInstance(doc,
new FileStream((Application.StartupPath+"\\PSC.pdf"), FileMode.Create));
doc.AddTitle("Recibo de Pago de Derechos Laborales");
doc.AddCreator("Errol");
doc.Open();
/*Get Image and set size*/
iTextSharp.text.Image SC = iTextSharp.text.Image.GetInstance(Application.StartupPath+"\\SimboloColones.png");
SC.ScaleAbsolute(5, 8);
PdfPTable table = new PdfPTable(3);/*3 columns*/
table.TotalWidth = 588;
table.LockedWidth = true;
/*Cell 1*/
Paragraph Preaviso = new Paragraph();
Preaviso.Add(new Chunk("Preaviso"));
Preaviso.Alignment = 2;
PdfPCell cell = new PdfPCell();
cell.Colspan = 1;
cell.HorizontalAlignment = 2;
cell.BorderColor = BaseColor.BLACK;
cell.BorderWidthBottom = 0;
cell.BorderWidthTop = 0;
cell.BorderWidthRight = 0;
cell.BorderWidthLeft = 0;
cell.AddElement(Preaviso);
table.AddCell(cell);
/*Cell 2*/
Paragraph pPreaviso = new Paragraph();
SC.ScaleAbsolute(5, 8);
pPreaviso.Add(new Chunk(SC, 0, 0));
pPreaviso.Add(new Chunk("Cant Pre"));
pPreaviso.Alignment = 0;
cell = new PdfPCell();
cell.Colspan = 1;
cell.HorizontalAlignment = 0;
cell.BorderColor = BaseColor.BLACK;
cell.AddElement(pPreaviso);
table.AddCell(cell);
/*Cell 3*/
cell = new PdfPCell(new Phrase(" "));
cell.Colspan = 1;
cell.HorizontalAlignment = 1;
cell.BorderColor = BaseColor.BLACK;
cell.BorderWidthBottom = 0;
cell.BorderWidthTop = 0;
cell.BorderWidthRight = 0;
cell.BorderWidthLeft = 0;
table.AddCell(cell);
doc.Add(table);
doc.Close();
writer.Close();
System.Diagnostics.Process.Start(Application.StartupPath+"\\PSC.pdf");
}

Itextsharp Header spacing with multiple column

I have created pdf file with itextsharp and I create Header ok but when I create table with two column. I don't have spacing from Header to my two column
The code
PdfPTable table1 = new PdfPTable(2);
table1.DefaultCell.Border = Rectangle.NO_BORDER;
table1.WidthPercentage = 100;
PdfPCell cell11 = new PdfPCell();
Paragraph UniName = new Paragraph(#"TRƯỜNG ĐẠI HỌC CÔNG NGHỆ ĐỒNG NAI", fontBold);
UniName.Alignment = Element.ALIGN_CENTER;
Paragraph paragraph = new Paragraph(#"PHÒNG ĐÀO TẠO", times);
paragraph.Alignment = Element.ALIGN_CENTER;
cell11.AddElement(UniName);
cell11.AddElement(paragraph);
cell11.BorderColor = BaseColor.WHITE;
PdfPCell cell12 = new PdfPCell();
Paragraph QH1 = new Paragraph(#"CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM", fontBold);
QH1.Alignment = Element.ALIGN_CENTER;
Paragraph QH = new Paragraph(#"Độc lập - Tự do - Hạnh phúc", fontBold);
QH.Alignment = Element.ALIGN_CENTER;
Paragraph Symbol = new Paragraph(#"----------oOo----------", fontBold);
Symbol.Alignment = Element.ALIGN_CENTER;
cell12.AddElement(QH1);
cell12.AddElement(QH);
cell12.AddElement(Symbol);
cell12.BorderColor = BaseColor.WHITE;
table1.AddCell(cell11);
table1.AddCell(cell12);
Paragraph TitleReport = new Paragraph(#"TỔNG HỢP COI CHẤM THI", titleFont);
TitleReport.Alignment = Element.ALIGN_CENTER;
Paragraph Info = new Paragraph(string.Format(#"Từ ngày: {0} đến ngày: {1} Đơn vị: {2}", DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy"), DateTime.Now.ToString("dd/MM/yyyy"), "Trung tâm quản lý chất lượng"), normalFont);
Info.Alignment = Element.ALIGN_LEFT;
Info.SpacingBefore = 20;
Info.SpacingAfter = 200;
PdfContentByte canvas = writer.DirectContent;
ColumnText ct = new ColumnText(canvas);
int side_of_the_page = 0;
ct.SetSimpleColumn(COLUMNS[side_of_the_page]);
int paragraphs = 0;
while (paragraphs < 28)
{
PdfPTable table = new PdfPTable(5);
table.AddCell("STT");
table.AddCell("Số Phách");
table.AddCell("Điểm bằng số");
table.AddCell("Điểm bằng chữ");
table.AddCell("Ghi chú");
for (int i = 0; i < 33; i++)
{
table.AddCell((i + 1).ToString());
table.AddCell("209292");
table.AddCell("4");
table.AddCell("Điểm bằng chữ");
table.AddCell("");
++paragraphs;
}
table.HeaderRows = 1;
//table.LockedWidth = true;
ct.AddElement(table);
//ct.AddElement(new Paragraph(String.Format("Paragraph {0}: {1}", , TEXT)));
while (ColumnText.HasMoreText(ct.Go()))
{
if (side_of_the_page == 0)
{
side_of_the_page = 1;
canvas.MoveTo(297.5f, 36);
canvas.LineTo(297.5f, 806);
canvas.Stroke();
}
else
{
side_of_the_page = 0;
doc.NewPage();
}
ct.SetSimpleColumn(COLUMNS[side_of_the_page]);
}
}
doc.Add(table1);
doc.Add(TitleReport);
doc.Add(Info);
(Also here)
The cause of the issue is that you mix automatic layout by iText (when you add the document header and title using doc.Add) and manual layout (when you add the content using a ColumnText).
The automatic layout by iText does not take any content added by manual layout into account. Thus, you have to take the content added via automatic layout into account for your manual layout (probably it would even be easier to use manual layout for everything).
Furthermore it is a bit surprising that you add the document title after all the content. Given enough content this pushes your title onto a page beyond the first!
And your while (paragraphs < 28) does not make any sense as in the first run through the while body you immediately push that variable beyond 28 in the inner loop for (int i = 0; i < 33; i++) { ...; ++paragraphs; }.
As in your code you add the header (table1, TitleReport, Info) only once, I assume you want to use this header on the first page only.
I changed your code by:
adding the header to the Document first,
requesting the current y position from the PdfWriter,
float afterHeaderY = writer.GetVerticalPosition(true);
assuming the PdfWriter being named writer,
using this y position as the top y coordinate of the columns and the center line on the first page reverting to the hard coded 806 on later pages, and
removing the while loop and code in comments.
The new code:
PdfPTable table1 = new PdfPTable(2);
table1.DefaultCell.Border = Rectangle.NO_BORDER;
table1.WidthPercentage = 100;
PdfPCell cell11 = new PdfPCell();
Paragraph UniName = new Paragraph(#"TRƯỜNG ĐẠI HỌC CÔNG NGHỆ ĐỒNG NAI", fontBold);
UniName.Alignment = Element.ALIGN_CENTER;
Paragraph paragraph = new Paragraph(#"PHÒNG ĐÀO TẠO", times);
paragraph.Alignment = Element.ALIGN_CENTER;
cell11.AddElement(UniName);
cell11.AddElement(paragraph);
cell11.BorderColor = BaseColor.WHITE;
PdfPCell cell12 = new PdfPCell();
Paragraph QH1 = new Paragraph(#"CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM", fontBold);
QH1.Alignment = Element.ALIGN_CENTER;
Paragraph QH = new Paragraph(#"Độc lập - Tự do - Hạnh phúc", fontBold);
QH.Alignment = Element.ALIGN_CENTER;
Paragraph Symbol = new Paragraph(#"----------oOo----------", fontBold);
Symbol.Alignment = Element.ALIGN_CENTER;
cell12.AddElement(QH1);
cell12.AddElement(QH);
cell12.AddElement(Symbol);
cell12.BorderColor = BaseColor.WHITE;
table1.AddCell(cell11);
table1.AddCell(cell12);
Paragraph TitleReport = new Paragraph(#"TỔNG HỢP COI CHẤM THI", titleFont);
TitleReport.Alignment = Element.ALIGN_CENTER;
Paragraph Info = new Paragraph(string.Format(#"Từ ngày: {0} đến ngày: {1} Đơn vị: {2}", DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy"), DateTime.Now.ToString("dd/MM/yyyy"), "Trung tâm quản lý chất lượng"), normalFont);
Info.Alignment = Element.ALIGN_LEFT;
Info.SpacingBefore = 20;
Info.SpacingAfter = 200;
doc.Add(table1);
doc.Add(TitleReport);
doc.Add(Info);
float afterHeaderY = writer.GetVerticalPosition(true);
Rectangle[] COLUMNS = new Rectangle[] {
new Rectangle(36, 36, 290, afterHeaderY),
new Rectangle(305, 36, 559, afterHeaderY)
};
PdfContentByte canvas = writer.DirectContent;
ColumnText ct = new ColumnText(canvas);
int side_of_the_page = 0;
ct.SetSimpleColumn(COLUMNS[side_of_the_page]);
PdfPTable table = new PdfPTable(5);
table.AddCell("STT");
table.AddCell("Số Phách");
table.AddCell("Điểm bằng số");
table.AddCell("Điểm bằng chữ");
table.AddCell("Ghi chú");
for (int i = 0; i < 33; i++)
{
table.AddCell((i + 1).ToString());
table.AddCell("209292");
table.AddCell("4");
table.AddCell("Điểm bằng chữ");
table.AddCell("");
}
table.HeaderRows = 1;
ct.AddElement(table);
while (ColumnText.HasMoreText(ct.Go()))
{
if (side_of_the_page == 0)
{
side_of_the_page = 1;
canvas.MoveTo(297.5f, 36);
canvas.LineTo(297.5f, afterHeaderY);
canvas.Stroke();
}
else
{
side_of_the_page = 0;
doc.NewPage();
COLUMNS = new Rectangle[] {
new Rectangle(36, 36, 290, 806),
new Rectangle(305, 36, 559, 806)
};
afterHeaderY = 806;
}
ct.SetSimpleColumn(COLUMNS[side_of_the_page]);
}
The result:
The big gap between header and content is due to your setting
Info.SpacingAfter = 200;
If you don't want that gap, reduce the value accordingly.

PdfPTable cell width

I'm using iTextSharp to create PDFs in my application. However I have to recreate a table, where I have to set the size for a very small column. Below is the picture that shows the size I want to set the column:
When the rest of the table creation all is well, I can't set this width.
Code:
PdfPTable table = new PdfPTable(2);
table.WidthPercentage = 82.0f;
PdfPCell cell = new PdfPCell(new Phrase("Com a assinatura autógrafa, o signatário desta Auto-declaração garante ter cumprido estas condições:", fontetexto));
cell.PaddingBottom = 10f;
cell.PaddingTop = 10f;
cell.Colspan = 2;
cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
table.AddCell(cell);
table.AddCell("1. ");
table.AddCell("Os óleos e gorduras vegetais velhos fornecidos são biomassa conforme o Decreto de biomassa.");
try with this code
PdfPTable table = new PdfPTable(new float[] { 30f, 400f });
table.HorizontalAlignment = 0;
table.TotalWidth = 500f;
table.LockedWidth = true;
table.SetWidths(widths);
You can do this with much less efforts if you use XmlParser rather then the normal HtmlParser
var document = new Document();
var workStream = new MemoryStream(); // or you can use fileStream also.
PdfWriter writer = PdfWriter.GetInstance(document, workStream);
XMLWorkerHelper.GetInstance().ParseXHtml(writer, document, stream, Encoding.UTF8);
Check this nuget MvcRazorToPdf ,I found this better then RazorPDF
The following code worked for me:
PdfPTable table = new PdfPTable(2);
table.TotalWidth = 500;
table.SetTotalWidth(new float[] { 30f, 400f });
PdfPCell c1 = new PdfPCell();
PdfPCell c2 = new PdfPCell();
c1.AddElement(new Phrase("first column"));
c1.AddElement(new Phrase("second column"));
table.Rows.Add(new PdfPRow(new PdfPCell[] { c1, c2 }));
The answer from #IntellectWizard help me to reach a solution.
float[] widths = new float[] { 100f, 4000f }; // Code #IntellectWizard
gives a corrupted file, then i try:
PdfPTable table = new PdfPTable(new float[] { 30f, 400f });
This works!

Categories

Resources