public Example_04() { String fileName = "data/happy-new-year.txt"; FileStream fos = new FileStream("Example_04.pdf", FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); pdf.setCompressor(Compressor.ORIGINAL_ZLIB); Font f1 = new Font( pdf, "AdobeMingStd-Light", // Chinese (Traditional) font CodePage.UNICODE); Font f2 = new Font( pdf, "AdobeSongStd-Light", // Chinese (Simplified) font CodePage.UNICODE); Font f3 = new Font( pdf, "KozMinProVI-Regular", // Japanese font CodePage.UNICODE); Font f4 = new Font( pdf, "AdobeMyungjoStd-Medium", // Korean font CodePage.UNICODE); Page page = new Page(pdf, Letter.PORTRAIT); f1.SetSize(14); f2.SetSize(14); f3.SetSize(14); f4.SetSize(14); double x_pos = 100.0; double y_pos = 20.0; StreamReader reader = new StreamReader( new FileStream(fileName, FileMode.Open)); TextLine text = new TextLine(f1); String line = null; while ((line = reader.ReadLine()) != null) { if (line.IndexOf("Simplified") != -1) { text.SetFont(f2); } else if (line.IndexOf("Japanese") != -1) { text.SetFont(f3); } else if (line.IndexOf("Korean") != -1) { text.SetFont(f4); } text.SetText(line); text.SetPosition(x_pos, y_pos += 24); text.DrawOn(page); } reader.Close(); pdf.Flush(); bos.Close(); }
//------------------------------------------------------------------------------------------- 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 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); }
/** * Draws this PlainText on the specified page. * * @param page the page to draw on. * @return x and y coordinates of the bottom right corner of this component. * @throws Exception */ public float[] DrawOn(Page page) { float originalSize = font.GetSize(); font.SetSize(fontSize); float y_text = y + font.GetAscent(); page.AddBMC(StructElem.SPAN, language, Single.space, Single.space); page.SetBrushColor(backgroundColor); leading = font.GetBodyHeight(); float h = font.GetBodyHeight() * textLines.Length; page.FillRect(x, y, w, h); page.SetPenColor(borderColor); page.SetPenWidth(0f); page.DrawRect(x, y, w, h); page.AddEMC(); page.AddBMC(StructElem.SPAN, language, altDescription, actualText); page.SetTextStart(); page.SetTextFont(font); page.SetBrushColor(textColor); page.SetTextLeading(leading); page.SetTextLocation(x, y_text); foreach (String str in textLines) { if (font.skew15) { SetTextSkew(page, 0.26f, x, y_text); } page.Println(str); endOfLinePoints.Add(new float[] { x + font.StringWidth(str), y_text }); y_text += leading; } page.SetTextEnd(); page.AddEMC(); font.SetSize(originalSize); return(new float[] { x + w, y + h }); }
public void SetTextFontInRow(int index, Font font, double size) { List <AbstractCell> list = this.tableData[index]; foreach (object current in list) { if (current is Cell) { Cell cell = (Cell)current; font.SetSize(size); cell.SetFont(font); } } }
public void SetTextFontInColumn(int index, Font font, double size) { foreach (List <AbstractCell> current in this.tableData) { if (index < current.Count) { object obj = current[index]; if (obj is Cell) { Cell cell = (Cell)obj; font.SetSize(size); cell.SetFont(font); } } } }
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 Example_08() { FileStream fos = new FileStream("Example_08.pdf", FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); pdf.setCompressor(Compressor.ORIGINAL_ZLIB); // Before you enable this flag please read README.ZLIB.TXT // in the 'optional' directory. Font f1 = new Font(pdf, "Helvetica-Bold"); f1.SetSize(7.0); Font f2 = new Font(pdf, "Helvetica"); f2.SetSize(7.0); Font f3 = new Font(pdf, "Helvetica-BoldOblique"); f3.SetSize(7.0); Page page = new Page(pdf, Letter.PORTRAIT); Table table = new Table(f1, f2); List<List<Cell>> tableData = GetData( "data/world-communications.txt", "|", Table.DATA_HAS_2_HEADER_ROWS, f1, f2); table.SetData(tableData, Table.DATA_HAS_2_HEADER_ROWS); table.SetLineWidth(0.2); table.SetPosition(70.0, 30.0); table.SetTextColorInRow(6, RGB.BLUE); table.SetTextColorInRow(39, RGB.RED); table.SetTextFontInRow(26, f3, 7); table.RemoveLineBetweenRows(0, 1); table.AutoAdjustColumnWidths(); table.SetColumnWidth(0, 120); table.RightAlignNumbers(); int numOfPages = table.GetNumberOfPages(page); while (true) { table.DrawOn(page); // TO DO: Draw "Page 1 of N" here if (!table.HasMoreData()) break; page = new Page(pdf, Letter.PORTRAIT); } pdf.Flush(); bos.Close(); }
public Example_05() { FileStream fos = new FileStream("Example_05.pdf", FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); pdf.setCompressor(Compressor.ORIGINAL_ZLIB); // Before you enable this flag please read README.ZLIB.TXT // in the 'optional' directory. // If PDF/A is not required use Helvetica, TimesRoman or Courier Font f1 = new Font(pdf, "Helvetica"); Page page = new Page(pdf, Letter.PORTRAIT); TextLine text = new TextLine(f1); text.SetPosition(300.0, 300.0); for (int i = 0; i < 360; i += 15) { text.SetTextDirection(i); text.SetUnderline(true); // text.SetStrikeLine(true); text.SetText(" Hello, World -- " + i + " degrees."); text.DrawOn(page); } text = new TextLine(f1, "WAVE AWAY"); text.SetPosition(70.0, 50.0); text.DrawOn(page); f1.SetKernPairs(true); text.SetPosition(70.0, 70.0); text.DrawOn(page); f1.SetKernPairs(false); text.SetPosition(70.0, 90.0); text.DrawOn(page); f1.SetSize(8); text = new TextLine(f1, "-- font.SetKernPairs(false);"); text.SetPosition(150.0, 50.0); text.DrawOn(page); text.SetPosition(150.0, 90.0); text.DrawOn(page); text = new TextLine(f1, "-- font.SetKernPairs(true);"); text.SetPosition(150.0, 70.0); text.DrawOn(page); Point point = new Point(300.0, 300.0); point.SetShape(Point.CIRCLE); point.SetFillShape(true); point.SetColor(RGB.BLUE); point.SetRadius(37.0); point.DrawOn(page); point.SetRadius(25.0); point.SetColor(RGB.WHITE); point.DrawOn(page); pdf.Flush(); bos.Close(); }
/// <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); }
/// <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); }
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" })); }
private float[] DrawCodeUPC(Page page, float x1, float y1) { float x = x1; float y = y1; float h = m1 * barHeightFactor; // Barcode height when drawn horizontally // Calculate the check digit: // 1. Add the digits in the odd-numbered positions (first, third, fifth, etc.) // together and multiply by three. // 2. Add the digits in the even-numbered positions (second, fourth, sixth, etc.) // to the result. // 3. Subtract the result modulo 10 from ten. // 4. The answer modulo 10 is the check digit. int sum = 0; for (int i = 0; i < 11; i += 2) { sum += text[i] - 48; } sum *= 3; for (int i = 1; i < 11; i += 2) { sum += text[i] - 48; } int reminder = sum % 10; int checkDigit = (10 - reminder) % 10; text += checkDigit.ToString(); x = DrawEGuard(page, x, y, m1, h + 8); for (int i = 0; i < 6; i++) { int digit = text[i] - 0x30; // page.DrawString(digit.ToString(), x + 1, y + h + 12); String symbol = tableA[digit].ToString(); for (int j = 0; j < symbol.Length; j++) { int n = symbol[j] - 0x30; if (j % 2 != 0) { DrawVertBar(page, x, y, n * m1, h); } x += n * m1; } } x = DrawMGuard(page, x, y, m1, h + 8); for (int i = 6; i < 12; i++) { int digit = text[i] - 0x30; // page.DrawString(digit.ToString(), x + 1, y + h + 12); String symbol = tableA[digit].ToString(); for (int j = 0; j < symbol.Length; j++) { int n = symbol[j] - 0x30; if (j % 2 == 0) { DrawVertBar(page, x, y, n * m1, h); } x += n * m1; } } x = DrawEGuard(page, x, y, m1, h + 8); float[] xy = new float[] { x, y }; if (font != null) { String label = text[0] + " " + text[1] + text[2] + text[3] + text[4] + text[5] + " " + text[6] + text[7] + text[8] + text[9] + text[10] + " " + text[11]; float fontSize = font.GetSize(); font.SetSize(10f); TextLine textLine = new TextLine(font, label); textLine.SetLocation( x1 + ((x - x1) - font.StringWidth(label)) / 2, y1 + h + font.bodyHeight); xy = textLine.DrawOn(page); xy[0] = Math.Max(x, xy[0]); xy[1] = Math.Max(y, xy[1]); font.SetSize(fontSize); return(new float[] { xy[0], xy[1] + font.descent }); } return(new float[] { xy[0], xy[1] }); }
public Example_13() { FileStream fos = new FileStream("Example_13.pdf", FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); pdf.setCompressor(Compressor.ORIGINAL_ZLIB); Font f1 = new Font(pdf, "Helvetica-Bold"); Font f2 = new Font(pdf, "Helvetica"); f1.SetSize(7.0); f2.SetSize(7.0); List<List<Cell>> tableData = new List<List<Cell>>(); StreamReader reader = new StreamReader( new FileStream("data/winter-2009.txt", FileMode.Open)); String line; while (( line = reader.ReadLine()) != null) { List<Cell> row = new List<Cell>(); String[] columns = line.Split(new Char[] {'|'}); for ( int i = 0; i < columns.Length; i++ ) { row.Add(new Cell(f2, columns[i])); } tableData.Add(row); } reader.Close(); Table table = new Table(f1, f2); table.SetData(tableData, Table.DATA_HAS_2_HEADER_ROWS); table.SetPosition(100.0, 50.0); table.setCellMargin(2.0); table.RemoveLineBetweenRows(0, 1); Cell cell3 = table.GetCellAt(1, 1); cell3.border.top = true; cell3 = table.GetCellAt(1, 2); cell3.border.top = true; SetFontForRow(table, 0, f1); SetFontForRow(table, 1, f1); table.AutoAdjustColumnWidths(); List<Cell> column = table.GetColumn(7); for ( int i = 0; i < column.Count; i++ ) { Cell cell = column[i]; cell.SetTextAlignment(Align.CENTER); } column = table.GetColumn(4); for ( int i = 2; i < column.Count; i++ ) { Cell cell = column[i]; try { cell.SetTextAlignment(Align.CENTER); if ( Int32.Parse( cell.GetText()) > 40 ) { cell.SetBgColor( new double[] { 0.0, 0.85, 0.0 } ); } else { cell.SetBgColor( new double[] { 1.0, 1.0, 0.0 } ); } } catch (Exception e) { Console.WriteLine(e); } } Cell cell2 = table.GetCellAt(0, 1); cell2.SetColSpan( 2 ); cell2.SetTextAlignment(Align.CENTER); SetBgColorForRow(table, 0, new double[] { 0.85, 0.85, 0.85 }); SetBgColorForRow(table, 1, new double[] { 0.85, 0.85, 0.85 }); table.SetColumnWidth(3, 10); blankOutColumn(table, 3); table.SetColumnWidth(8, 10); blankOutColumn(table, 8); Page page = new Page(pdf, Letter.PORTRAIT); int numOfPages = table.GetNumberOfPages(page); int pageNumber = 1; while (true) { table.DrawOn(page); TextLine text = new TextLine(f1); text.SetText("Page " + pageNumber++ + " of " + numOfPages); text.SetPosition(300.0, 780.0); text.DrawOn(page); if (!table.HasMoreData()) break; page = new Page(pdf, Letter.PORTRAIT); } pdf.Flush(); bos.Close(); }
private void drawCodeUPC(Page page) { float x = x1; float y = y1; float h = m1 * barHeightFactor; // Barcode height when drawn horizontally // Calculate the check digit: // 1. Add the digits in the odd-numbered positions (first, third, fifth, etc.) // together and multiply by three. // 2. Add the digits in the even-numbered positions (second, fourth, sixth, etc.) // to the result. // 3. Subtract the result modulo 10 from ten. // 4. The answer modulo 10 is the check digit. int sum = 0; for (int i = 0; i < 11; i += 2) { sum += str[i] - 48; } sum *= 3; for (int i = 1; i < 11; i += 2) { sum += str[i] - 48; } int reminder = sum % 10; int check_digit = (10 - reminder) % 10; str += check_digit.ToString(); x = drawEGuard(page, x, y, m1, h + 8); for (int i = 0; i < 6; i++) { int digit = str[i] - 0x30; // page.DrawString(digit.ToString(), x + 1, y + h + 12); String symbol = tableA[digit].ToString(); int n; for (int j = 0; j < symbol.Length; j++) { n = symbol[j] - 0x30; if (j % 2 != 0) { drawVertBar(page, x, y, n * m1, h); } x += n * m1; } } x = drawMGuard(page, x, y, m1, h + 8); for (int i = 6; i < 12; i++) { int digit = str[i] - 0x30; // page.DrawString(digit.ToString(), x + 1, y + h + 12); String symbol = tableA[digit].ToString(); int n; for (int j = 0; j < symbol.Length; j++) { n = symbol[j] - 0x30; if (j % 2 == 0) { drawVertBar(page, x, y, n * m1, h); } x += n * m1; } } x = drawEGuard(page, x, y, m1, h + 8); if (font != null) { String label = str[0] + " " + str[1] + str[2] + str[3] + str[4] + str[5] + " " + str[6] + str[7] + str[8] + str[9] + str[10] + " " + str[11]; float fontSize = font.GetSize(); font.SetSize(10.0); page.DrawString( font, label, x1 + ((x - x1) - font.StringWidth(label)) / 2, y1 + h + font.body_height); font.SetSize(fontSize); } }