internal void RegisterAsComposite( PDF pdf, Font font, Stream inputStream, bool embed) { otf = new OTF(inputStream); if (embed) { EmbedFontFile(pdf, font, otf, false); } AddFontDescriptorObject(pdf, font, otf, embed); AddCIDFontDictionaryObject(pdf, font, otf); AddToUnicodeCMapObject(pdf, font, otf); // Type0 Font Dictionary pdf.Newobj(); pdf.Append("<<\n"); pdf.Append("/Type /Font\n"); pdf.Append("/Subtype /Type0\n"); pdf.Append("/BaseFont /"); pdf.Append(otf.fontName); pdf.Append('\n'); pdf.Append("/Encoding /Identity-H\n"); pdf.Append("/DescendantFonts ["); pdf.Append(font.GetCidFontDictObjNumber()); pdf.Append(" 0 R]\n"); pdf.Append("/ToUnicode "); pdf.Append(font.GetToUnicodeCMapObjNumber()); pdf.Append(" 0 R\n"); pdf.Append(">>\n"); pdf.Endobj(); font.objNumber = pdf.objNumber; }
//------------------------------------------------------------------------------------------- private void DrawText(PDFjet.NET.PDF pdf, PDFjet.NET.Page page, string text, int x, int y) { Font f1 = new Font(pdf, "Helvetica"); f1.SetSize(10); PDFjet.NET.TextLine tLine = new TextLine(f1); tLine.SetText(text); tLine.SetPosition(x, y); //tLine.SetURIAction("http://www.weavver.com/accounting/"); tLine.DrawOn(page); }
public Text(List<Paragraph> paragraphs) { this.paragraphs = paragraphs; this.font = paragraphs[0].list[0].GetFont(); this.fallbackFont = paragraphs[0].list[0].GetFallbackFont(); this.leading = font.GetBodyHeight(); this.paragraphLeading = 2*leading; this.beginParagraphPoints = new List<float[]>(); this.endParagraphPoints = new List<float[]>(); this.spaceBetweenTextLines = font.StringWidth(fallbackFont, " "); }
public static void DrawPageNumber(PDF pdf, Page page, int pageNumber) { PDFjet.NET.Font font = new PDFjet.NET.Font(pdf, CoreFont.HELVETICA_BOLD); font.SetSize(7f); TextLine textLine = new TextLine(font); string text = string.Format(LangRes.PageNo, pageNumber); textLine.SetText(text); textLine.SetLocation(pdfUtil.PDFLoctx_pageNo, pdfUtil.PDFLocty_pageNo); textLine.DrawOn(page); }
public PlainText(Font font, String[] textLines) { this.font = font; this.fontSize = font.GetSize(); this.textLines = textLines; this.endOfLinePoints = new List<float[]>(); StringBuilder buf = new StringBuilder(); foreach (String str in textLines) { buf.Append(str); buf.Append(' '); } this.altDescription = buf.ToString(); this.actualText = buf.ToString(); }
internal void RegisterAsSimple( PDF pdf, Font font, Stream inputStream, int codePage, bool embed) { otf = new OTF(inputStream); if (embed) { EmbedFontFile(pdf, font, otf, true); } AddFontDescriptorObject(pdf, font, otf, embed); AddWidthsArrayObject(pdf, font, otf, codePage); AddEncodingObject(pdf, font, codePage); // Simple font object pdf.Newobj(); pdf.Append("<<\n"); pdf.Append("/Type /Font\n"); if (otf.cff) { pdf.Append("/Subtype /Type1\n"); } else { pdf.Append("/Subtype /TrueType\n"); } pdf.Append("/BaseFont /"); pdf.Append(otf.fontName); pdf.Append('\n'); pdf.Append("/FirstChar "); pdf.Append(otf.firstChar); pdf.Append('\n'); pdf.Append("/LastChar "); pdf.Append(255); pdf.Append('\n'); pdf.Append("/Encoding "); pdf.Append(font.GetEncodingObjNumber()); pdf.Append(" 0 R\n"); pdf.Append("/Widths "); pdf.Append(font.GetWidthsArrayObjNumber()); pdf.Append(" 0 R\n"); pdf.Append("/FontDescriptor "); pdf.Append(font.GetFontDescriptorObjNumber()); pdf.Append(" 0 R\n"); pdf.Append(">>\n"); pdf.Endobj(); font.objNumber = pdf.objNumber; }
public static void DrawTitle(PDF pdf, Page page, string title, float offsetY, float fontsize, int txtAlign) { PDFjet.NET.Font font = new PDFjet.NET.Font(pdf, CoreFont.TIMES_BOLD); font.SetSize(fontsize); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append(title); TextBox textBox = new TextBox(font, stringBuilder.ToString(), pdfUtil.PDFpageeffwidth, 20f); textBox.SetLocation(pdfUtil.PDFleft_margin, pdfUtil.PDFtop_margin + offsetY); textBox.SetVerticalAlignment(0); textBox.SetTextAlignment(txtAlign); textBox.SetBorder(65536, false); textBox.SetBorder(131072, false); textBox.SetBorder(262144, false); textBox.SetBorder(524288, false); textBox.DrawOn(page); }
public void AddChineseParagraph(Font font, String chinese) { Paragraph p = null; StringBuilder buf = new StringBuilder(); for (int i = 0; i < chinese.Length; i++) { char ch = chinese[i]; if (font.StringWidth(buf.ToString() + ch) > w) { p = new Paragraph(); p.Add(new TextLine(font, buf.ToString())); AddParagraph(p); buf.Length = 0; } buf.Append(ch); } p = new Paragraph(); p.Add(new TextLine(font, buf.ToString())); AddParagraph(p); }
/** * Creates a text box and sets the font and the text. * * @param font the font. * @param text the text. * @param width the width. * @param height the height. */ public TextBox(Font font, String text, float width, float height) { this.font = font; this.text = text; this.width = width; this.height = height; }
/** * Creates a text box and sets the font. * * @param font the font. */ public TextBox(Font font) { this.font = font; }
/** * Creates a text box and sets the font and the text. * * @param font the font. * @param text the text. * @param width the width. * @param height the height. */ public TextBox(Font font, String text, double width, double height) : this(font, text, (float) width, (float) height) { }
private void AddFontDescriptorObject( PDF pdf, Font font, OTF otf, bool embed) { float factor = 1000f / otf.unitsPerEm; for (int i = 0; i < pdf.fonts.Count; i++) { Font f = pdf.fonts[i]; if (f.name.Equals(otf.fontName) && f.GetFontDescriptorObjNumber() != -1) { font.SetFontDescriptorObjNumber(f.GetFontDescriptorObjNumber()); return; } } pdf.Newobj(); pdf.Append("<<\n"); pdf.Append("/Type /FontDescriptor\n"); pdf.Append("/FontName /"); pdf.Append(otf.fontName); pdf.Append('\n'); if (embed) { if (otf.cff) { pdf.Append("/FontFile3 "); } else { pdf.Append("/FontFile2 "); } pdf.Append(font.fileObjNumber); pdf.Append(" 0 R\n"); } pdf.Append("/Flags 32\n"); pdf.Append("/FontBBox ["); pdf.Append(otf.bBoxLLx * factor); pdf.Append(' '); pdf.Append(otf.bBoxLLy * factor); pdf.Append(' '); pdf.Append(otf.bBoxURx * factor); pdf.Append(' '); pdf.Append(otf.bBoxURy * factor); pdf.Append("]\n"); pdf.Append("/Ascent "); pdf.Append(otf.ascent * factor); pdf.Append('\n'); pdf.Append("/Descent "); pdf.Append(otf.descent * factor); pdf.Append('\n'); pdf.Append("/ItalicAngle 0\n"); pdf.Append("/CapHeight "); pdf.Append(otf.capHeight * factor); pdf.Append('\n'); pdf.Append("/StemV 79\n"); pdf.Append(">>\n"); pdf.Endobj(); font.SetFontDescriptorObjNumber(pdf.objNumber); }
private void AddEncodingObject( PDF pdf, Font font, int codePage) { pdf.Newobj(); pdf.Append("<<\n"); pdf.Append("/Type /Encoding\n"); pdf.Append("/BaseEncoding /WinAnsiEncoding\n"); pdf.Append("/Differences [127\n"); for (int i = 0; i < 129; i++) { if (codePage == 0) { pdf.Append(CP1250.names[i]); } else if (codePage == 1) { pdf.Append(CP1251.names[i]); } else if (codePage == 2) { pdf.Append(CP1252.names[i]); } else if (codePage == 3) { pdf.Append(CP1253.names[i]); } else if (codePage == 4) { pdf.Append(CP1254.names[i]); } else if (codePage == 7) { pdf.Append(CP1257.names[i]); } pdf.Append(' '); } pdf.Append("]\n"); pdf.Append(">>\n"); pdf.Endobj(); font.SetEncodingObjNumber(pdf.objNumber); }
/** * Sets the font for the specified column. * * @param index the column index. * @param font the font. */ public void SetFontInColumn(int index, Font font) { for (int i = 0; i < tableData.Count; i++) { List<Cell> row = tableData[i]; if (index < row.Count) { row[index].font = font; } } }
/** * Create a XY chart object. * * @param f1 the font used for the chart title. * @param f2 the font used for the X and Y axis titles. */ public Chart(Font f1, Font f2) { this.f1 = f1; this.f2 = f2; nf = NumberFormat.getInstance(); }
public void SetFallbackFont(Font font) { this.fallbackFont = font; }
/// <summary> /// Populate a voter card with the information of a given voter. /// </summary> /// <param name="page">The page containing the card.</param> /// <param name="pdf">The pdf containing the page.</param> /// <param name="xO">The horizontal offset of the card in points.</param> /// <param name="yO">The vertical offset of the card in points.</param> /// <param name="voter">The voter whose information to be populated onto the card.</param> private static void PopulateCard(Page page, PDF pdf, double xO, double yO, VoterDO voter) { // ----- POPULATE: POLLING STATION ----- PollingStationDO ps = voter.PollingStation; var font = new Font(pdf, CoreFont.HELVETICA); font.SetSize(9); var t = new TextLine(font, ps.Name); t.SetPosition(xO + 9 * U, yO + 27.5 * U); t.DrawOn(page); t = new TextLine(font, ps.Address); t.SetPosition(xO + 9 * U, yO + 32 * U); t.DrawOn(page); t = new TextLine(font, "valgfrit"); t.SetPosition(xO + 29 * U, yO + 48.8 * U); t.DrawOn(page); t = new TextLine(font, "02-04861"); t.SetPosition(xO + 29 * U, yO + 58.7 * U); t.DrawOn(page); t = new TextLine(font, "09:00 - 20:00"); t.SetPosition(xO + 29 * U, yO + 68.2 * U); t.DrawOn(page); // ----- POPULATE: VOTER ----- MunicipalityDO mun = voter.PollingStation.Municipality; font = new Font(pdf, CoreFont.COURIER); font.SetSize(10); // Add top voter number 'Vælgernr.' t = new TextLine(font, "02-04861"); t.SetPosition(xO + 102 * U, yO + 12 * U); t.DrawOn(page); // Add sender 'Afsender' t = new TextLine(font, mun.Name); t.SetPosition(xO + 102 * U, yO + 32.5 * U); t.DrawOn(page); t = new TextLine(font, mun.Address); t.SetPosition(xO + 102 * U, yO + 36.5 * U); t.DrawOn(page); t = new TextLine(font, mun.City); t.SetPosition(xO + 102 * U, yO + 40.5 * U); t.DrawOn(page); // Add reciever 'Modtager' t = new TextLine(font, voter.Name); t.SetPosition(xO + 102 * U, yO + 62.5 * U); t.DrawOn(page); t = new TextLine(font, voter.Address); t.SetPosition(xO + 102 * U, yO + 66.5 * U); t.DrawOn(page); t = new TextLine(font, voter.City); t.SetPosition(xO + 102 * U, yO + 70.5 * U); t.DrawOn(page); // Add CPR barcode string barcode = BarCodeHashing.Hash(voter.PrimaryKey.Value).ToString(); var b = new BarCode(BarCode.CODE128, barcode); b.SetPosition(xO + 160 * U, yO + 60 * U); b.DrawOn(page); t = new TextLine(font, barcode); t.SetPosition(xO + 160 * U, yO + 72 * U); t.DrawOn(page); }
public Form SetValueFont(Font f2) { this.f2 = f2; return this; }
public Form SetLabelFont(Font f1) { this.f1 = f1; return this; }
private void AddWidthsArrayObject( PDF pdf, Font font, OTF otf, int codePage) { pdf.Newobj(); pdf.Append("[ "); int n = 1; for (int c = otf.firstChar; c < 256; c++) { if (c < 127) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[c])); } else { if (codePage == 0) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[CP1250.codes[c - 127]])); } else if (codePage == 1) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[CP1251.codes[c - 127]])); } else if (codePage == 2) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[CP1252.codes[c - 127]])); } else if (codePage == 3) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[CP1253.codes[c - 127]])); } else if (codePage == 4) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[CP1254.codes[c - 127]])); } else if (codePage == 7) { pdf.Append((int) ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[CP1257.codes[c - 127]])); } } if (n < 10) { pdf.Append(' '); ++n; } else { pdf.Append('\n'); n = 1; } } pdf.Append("]\n"); pdf.Endobj(); font.SetWidthsArrayObjNumber(pdf.objNumber); }
private void EmbedFontFile( PDF pdf, Font font, OTF otf, bool simpleFont) { // Check if the font file is already embedded for (int i = 0; i < pdf.fonts.Count; i++) { Font f = pdf.fonts[i]; if (f.name.Equals(otf.fontName) && f.fileObjNumber != -1) { font.fileObjNumber = f.fileObjNumber; return; } } int metadataObjNumber = -1; if (otf.fontName.ToLower().IndexOf("droid") != -1 || otf.fontName.ToLower().IndexOf("roboto") != -1) { metadataObjNumber = pdf.AddMetadataObject(AndroidFontsCopyright.NOTICE, true); } pdf.Newobj(); pdf.Append("<<\n"); if (otf.cff) { if (simpleFont) { pdf.Append("/Subtype /Type1C\n"); } else { pdf.Append("/Subtype /CIDFontType0C\n"); } } pdf.Append("/Filter /FlateDecode\n"); pdf.Append("/Length "); pdf.Append(otf.baos.Length); pdf.Append("\n"); if (!otf.cff) { pdf.Append("/Length1 "); pdf.Append(otf.buf.Length); pdf.Append('\n'); } if (metadataObjNumber != -1) { pdf.Append("/Metadata "); pdf.Append(metadataObjNumber); pdf.Append(" 0 R\n"); } pdf.Append(">>\n"); pdf.Append("stream\n"); pdf.Append(otf.baos); pdf.Append("\nendstream\n"); pdf.Endobj(); font.fileObjNumber = pdf.objNumber; }
/// <summary> /// Generate lines, boxes, watermark and default text of a single voter card. /// </summary> /// <param name="page">The page containing the card.</param> /// <param name="pdf">The pdf containing the page.</param> /// <param name="xO">The horizontal offset of the card in points.</param> /// <param name="yO">The vertical offset of the card in points.</param> private static void GenerateCard(Page page, PDF pdf, double xO, double yO) { // Add watermark. var font = new Font(pdf, CoreFont.HELVETICA_BOLD); font.SetSize(55); var t = new TextLine(font, "FAKE VALGKORT"); var lightBlue = new[] { 0.647, 0.812, 0.957 }; t.SetColor(lightBlue); t.SetPosition(xO + 20 * U, yO + 50 * U); t.DrawOn(page); // Add 'Afstemningssted' box. var b = new Box(xO + 6 * U, yO + 20 * U, 80 * U, 22 * U); b.DrawOn(page); // Add 'Valgbord' box. b = new Box(xO + 6 * U, yO + 44.5 * U, 80 * U, 7 * U); b.DrawOn(page); // Add 'Vælgernr' box. b = new Box(xO + 6 * U, yO + 54 * U, 80 * U, 7 * U); b.DrawOn(page); // Add 'Afstemningstid' box. b = new Box(xO + 6 * U, yO + 63.5 * U, 80 * U, 7 * U); b.DrawOn(page); // Add lines. var l = new Line(xO + 96 * U, yO + 5 * U, xO + 96 * U, yO + 85 * U); l.DrawOn(page); l = new Line(xO + 96 * U, yO + 25 * U, xO + 205 * U, yO + 25 * U); l.DrawOn(page); l = new Line(xO + 96 * U, yO + 45 * U, xO + 205 * U, yO + 45 * U); l.DrawOn(page); l = new Line(xO + 6 * U, yO + 85 * U, xO + 205 * U, yO + 85 * U); l.DrawOn(page); // Add default text. font = new Font(pdf, CoreFont.HELVETICA); font.SetSize(7); t = new TextLine(font, "Afstemningssted:"); t.SetPosition(xO + 7 * U, yO + 23 * U); t.DrawOn(page); t = new TextLine(font, "Vælgernr.:"); t.SetPosition(xO + 7 * U, yO + 58 * U); t.DrawOn(page); t = new TextLine(font, "Afstemningstid:"); t.SetPosition(xO + 7 * U, yO + 68 * U); t.DrawOn(page); t = new TextLine(font, "Afsender:"); t.SetPosition(xO + 98 * U, yO + 29 * U); t.DrawOn(page); t = new TextLine(font, "Modtager:"); t.SetPosition(xO + 98 * U, yO + 49 * U); t.DrawOn(page); font = new Font(pdf, CoreFont.HELVETICA); font.SetSize(9); t = new TextLine(font, "Folketingsvalg"); t.SetPosition(xO + 7 * U, yO + 10 * U); t.DrawOn(page); t = new TextLine(font, "20. november 2001"); t.SetPosition(xO + 7 * U, yO + 14 * U); t.DrawOn(page); t = new TextLine(font, "Valgbord:"); t.SetPosition(xO + 7 * U, yO + 49 * U); t.DrawOn(page); font = new Font(pdf, CoreFont.HELVETICA_OBLIQUE); font.SetSize(7); t = new TextLine(font, "Medbring kortet ved afstemningen"); t.SetPosition(xO + 6.5 * U, yO + 18.5 * U); t.DrawOn(page); }
public void SetTextFontInColumn( int index, Font font, double size) { for (int i = 0; i < tableData.Count; i++) { List<Cell> row = tableData[i]; if (index < row.Count) { row[index].font = font; row[index].font.SetSize(size); } } }
private void AddCIDFontDictionaryObject( PDF pdf, Font font, OTF otf) { for (int i = 0; i < pdf.fonts.Count; i++) { Font f = pdf.fonts[i]; if (f.name.Equals(otf.fontName) && f.GetCidFontDictObjNumber() != -1) { font.SetCidFontDictObjNumber(f.GetCidFontDictObjNumber()); return; } } pdf.Newobj(); pdf.Append("<<\n"); pdf.Append("/Type /Font\n"); if (otf.cff) { pdf.Append("/Subtype /CIDFontType0\n"); } else { pdf.Append("/Subtype /CIDFontType2\n"); } pdf.Append("/BaseFont /"); pdf.Append(otf.fontName); pdf.Append('\n'); pdf.Append("/CIDSystemInfo <</Registry (Adobe) /Ordering (Identity) /Supplement 0>>\n"); pdf.Append("/FontDescriptor "); pdf.Append(font.GetFontDescriptorObjNumber()); pdf.Append(" 0 R\n"); pdf.Append("/DW "); pdf.Append((int) ((1000f / otf.unitsPerEm) * otf.advanceWidth[0])); pdf.Append('\n'); pdf.Append("/W [0[\n"); for (int i = 0; i < otf.advanceWidth.Length; i++) { pdf.Append((int) ((1000f / otf.unitsPerEm) * otf.advanceWidth[i])); if ((i + 1) % 10 == 0) { pdf.Append('\n'); } else { pdf.Append(' '); } } pdf.Append("]]\n"); pdf.Append("/CIDToGIDMap /Identity\n"); pdf.Append(">>\n"); pdf.Endobj(); font.SetCidFontDictObjNumber(pdf.objNumber); }
public Table(Font f1, Font f2) { this.f1 = f1; this.f2 = f2; tableData = new List<List<Cell>>(); }
/** * Sets the font for the specified row. * * @param index the row index. * @param font the font. */ public void SetFontInRow(int index, Font font) { List<Cell> row = tableData[index]; for (int i = 0; i < row.Count; i++) { row[i].font = font; } }
/** * Creates a RadioButton that is not selected. * */ public RadioButton(Font font, String label) { this.font = font; this.label = label; }
public Cell(Font font) { this.font = font; this.border = new Border(); }
private void AddToUnicodeCMapObject( PDF pdf, Font font, OTF otf) { for (int i = 0; i < pdf.fonts.Count; i++) { Font f = pdf.fonts[i]; if (f.name.Equals(otf.fontName) && f.GetToUnicodeCMapObjNumber() != -1) { font.SetToUnicodeCMapObjNumber(f.GetToUnicodeCMapObjNumber()); return; } } StringBuilder sb = new StringBuilder(); sb.Append("/CIDInit /ProcSet findresource begin\n"); sb.Append("12 dict begin\n"); sb.Append("begincmap\n"); sb.Append("/CIDSystemInfo <</Registry (Adobe) /Ordering (Identity) /Supplement 0>> def\n"); sb.Append("/CMapName /Adobe-Identity def\n"); sb.Append("/CMapType 2 def\n"); sb.Append("1 begincodespacerange\n"); sb.Append("<0000> <FFFF>\n"); sb.Append("endcodespacerange\n"); List<String> list = new List<String>(); StringBuilder buf = new StringBuilder(); for (int cid = 0; cid <= 0xffff; cid++) { int gid = otf.unicodeToGID[cid]; if (gid > 0) { buf.Append('<'); buf.Append(ToHexString(gid)); buf.Append("> <"); buf.Append(ToHexString(cid)); buf.Append(">\n"); list.Add(buf.ToString()); buf.Length = 0; if (list.Count == 100) { WriteListToBuffer(list, sb); } } } if (list.Count > 0) { WriteListToBuffer(list, sb); } sb.Append("endcmap\n"); sb.Append("CMapName currentdict /CMap defineresource pop\n"); sb.Append("end\nend"); pdf.Newobj(); pdf.Append("<<\n"); pdf.Append("/Length "); pdf.Append(sb.Length); pdf.Append("\n"); pdf.Append(">>\n"); pdf.Append("stream\n"); pdf.Append(sb.ToString()); pdf.Append("\nendstream\n"); pdf.Endobj(); font.SetToUnicodeCMapObjNumber(pdf.objNumber); }
public void SetTextFontInRow( int index, Font font, double size) { List<Cell> row = tableData[index]; for (int i = 0; i < row.Count; i++) { row[i].font = font; row[i].font.SetSize(size); } }
public Cell(Font font, String text) { this.font = font; this.text = text; this.border = new Border(); }
/** * Sets the font to be used with this barcode. * * @param font the specified font. */ public void SetFont(Font font) { this.font = font; }
private void exportPDF(string path, string name) { commUtil.ShowInfo_DEBUG(" Save --pdf (" + name + ")----- Start == " + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")); PDF pDF = new PDF(new System.IO.BufferedStream(new System.IO.FileStream(path + "\\" + name + ".pdf", System.IO.FileMode.Create))); PDFjet.NET.Font font = new PDFjet.NET.Font(pDF, CoreFont.TIMES_BOLD); font.SetSize(7f); PDFjet.NET.Font font2 = new PDFjet.NET.Font(pDF, CoreFont.TIMES_ROMAN); font2.SetSize(7f); int num = 1; Page page = new Page(pDF, Letter.PORTRAIT); pdfUtil.DrawTitle(pDF, page, this.lbTitle.Text, 0f, 12f, 1048576); string msg = EcoLanguage.getMsg(LangRes.Rpt_BillTitle, new string[] { this.m_pParaClass.Txtwriter, this.m_pParaClass.Dtptime }); pdfUtil.DrawTitle(pDF, page, msg, 30f, 10f, 2097152); System.Collections.Generic.List <System.Collections.Generic.List <Cell> > list = new System.Collections.Generic.List <System.Collections.Generic.List <Cell> >(); System.Collections.Generic.List <Cell> list2 = new System.Collections.Generic.List <Cell>(); for (int i = 0; i < this.dgvBilling.ColumnCount; i++) { Cell cell = new Cell(font, this.dgvBilling.Columns[i].HeaderText); cell.SetTextAlignment(1048576); list2.Add(cell); } list.Add(list2); for (int j = 0; j < this.dgvBilling.Rows.Count; j++) { list2 = new System.Collections.Generic.List <Cell>(); for (int k = 0; k < this.dgvBilling.ColumnCount; k++) { Cell cell = new Cell(font2, this.dgvBilling.Rows[j].Cells[k].Value.ToString()); if (this.dgvBilling.Rows[j].Cells[k].Style.Alignment == DataGridViewContentAlignment.MiddleRight || this.dgvBilling.Columns[k].DefaultCellStyle.Alignment == DataGridViewContentAlignment.MiddleRight) { cell.SetTextAlignment(2097152); } list2.Add(cell); } list.Add(list2); } System.Collections.Generic.List <float> list3 = new System.Collections.Generic.List <float>(); int tableType_index = this.m_pParaClass.tableType_index; for (int l = 0; l < this.dgvBilling.Columns.Count; l++) { float item = pdfUtil.PDFpageeffwidth / (float)this.dgvBilling.Size.Width * (float)BillingRptShow.TableWidth[tableType_index][l]; list3.Add(item); } Page page2 = pdfUtil.DrawTable(pDF, page, ref num, list, Table.DATA_HAS_1_HEADER_ROWS, 55f, list3); pdfUtil.DrawPageNumber(pDF, page2, num++); pDF.Close(); commUtil.ShowInfo_DEBUG(string.Concat(new string[] { " Save --pdf (", name, ")----- End == ", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"), "\n" })); }