public void DrawOn(Page page) { if (fill_shape) { page.SetBrushColor( color[0], color[1], color[2]); } else { page.SetPenColor( color[0], color[1], color[2]); } page.setPenWidth(width); page.SetLinePattern(pattern); for (int i = 0; i < points.Count; i++) { Point point = points[i]; point.x += box_x; point.y += box_y; } if (fill_shape) { page.drawPath(points, 'f'); } else { if (close_path) { page.drawPath(points, 's'); } else { page.drawPath(points, 'S'); } } for (int i = 0; i < points.Count; i++) { Point point = points[i]; point.x -= box_x; point.y -= box_y; } }
/** * Draws this barcode on the specified page. * * @param page the specified page. */ public void DrawOn(Page page) { for (int row = 0; row < modules.Length; row++) { for (int col = 0; col < modules.Length; col++) { if (IsDark(row, col)) { page.FillRect(x + col*m1, y + row*m1, m1, m1); } } } }
public void DrawOn(Page page) { page.SetPenColor(color[0], color[1], color[2]); page.setPenWidth(width); page.SetLinePattern(pattern); page.drawLine( x1 + box_x, y1 + box_y, x2 + box_x, y2 + box_y); }
public float[] DrawOn(Page page) { if (numberOfRows == 0) { return new float[] { x, y }; } float boxHeight = rowHeight*numberOfRows; Box box = new Box(); box.SetLocation(x, y); box.SetSize(rowLength, boxHeight); box.DrawOn(page); float field_y = 0f; int row_span = 1; float row_y = 0; foreach (Field field in fields) { if (field.x == 0f) { row_y += row_span*rowHeight; row_span = field.values.Length; } field_y = row_y; for (int i = 0; i < field.values.Length; i++) { Font font = (i == 0) ? f1 : f2; float fontSize = (i == 0) ? labelFontSize : valueFontSize; int color = (i == 0) ? labelColor : valueColor; new TextLine(font, field.values[i]) .SetFontSize(fontSize) .SetColor(color) .PlaceIn(box, field.x + f1.GetDescent(), field_y - font.GetDescent()) .SetAltDescription((i == 0) ? field.altDescription[i] : (field.altDescription[i] + ",")) .SetActualText((i == 0) ? field.actualText[i] : (field.actualText[i] + ",")) .DrawOn(page); endOfLinePoints.Add(new float[] { field.x + f1.GetDescent() + font.StringWidth(field.values[i]), field_y - font.GetDescent(), }); if (i == (field.values.Length - 1)) { new Line(0f, 0f, rowLength, 0f) .PlaceIn(box, 0f, field_y) .DrawOn(page); if (field.x != 0f) { new Line(0f, -(field.values.Length-1)*rowHeight, 0f, 0f) .PlaceIn(box, field.x, field_y) .DrawOn(page); } } field_y += rowHeight; } } return new float[] { x + rowLength, y + boxHeight }; }
public void DrawOn(Page page, bool draw) { if (!draw) return; page.SetTextDirection(degrees); x += box_x; y += box_y; if (uri != null) { page.annots.Add(new Annotation(uri, x, page.height - (y - font.ascent), x + font.StringWidth(str), page.height - (y - font.descent))); } if (str != null) { page.SetBrushColor( color[0], color[1], color[2]); page.drawString(font, str, x, y); } if (underline) { page.setPenWidth(font.underlineThickness); page.SetPenColor(color[0], color[1], color[2]); double lineLength = font.StringWidth(str); double radians = Math.PI * degrees / 180.0; double x_adjust = font.underlinePosition * Math.Sin(radians); double y_adjust = font.underlinePosition * Math.Cos(radians); double x2 = x + lineLength * Math.Cos(radians); double y2 = y - lineLength * Math.Sin(radians); page.moveTo(x + x_adjust, y + y_adjust); page.lineTo(x2 + x_adjust, y2 + y_adjust); page.strokePath(); } if (strike) { page.setPenWidth(font.underlineThickness); page.SetPenColor(color[0], color[1], color[2]); double lineLength = font.StringWidth(str); double radians = Math.PI * degrees / 180.0; double x_adjust = ( font.body_height / 4.0 ) * Math.Sin(radians); double y_adjust = ( font.body_height / 4.0 ) * Math.Cos(radians); double x2 = x + lineLength * Math.Cos(radians); double y2 = y - lineLength * Math.Sin(radians); page.moveTo(x - x_adjust, y - y_adjust); page.lineTo(x2 - x_adjust, y2 - y_adjust); page.strokePath(); } page.SetTextDirection(0); }
//------------------------------------------------------------------------------------------- /// <summary> /// This method generates a PDF copy of the check to be printed on standard 3 sheet check paper. /// </summary> /// <param name="db"></param> /// <param name="invoice"></param> /// <returns>Returns the path to the PDF file on the local file system.</returns> public string GeneratePDF() { string filepath = System.IO.Path.GetTempFileName() + ".pdf"; FileStream fos = new FileStream(filepath, FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); Page p = new PDFjet.NET.Page(pdf, Letter.PORTRAIT); // these two variables are lazy loaded from the db so we cache them here Logistics_Addresses payeeAddress = PayeeAddress; string payeeName = PayeeName; for (int i = 0; i < 3; i++) { int yoffset = i * 251; // these lines draw a seperation line between the 3 parts on a full check sheet which is useful for debugging //Line l = new Line(0, yoffset, 400, yoffset); //l.DrawOn(p); //yoffset += 25; // draw the date DrawText(pdf, p, PostAt.ToString("MM/dd/yy"), 515, yoffset + 70); int xnameoffset = (i == 0) ? 85 : 30; DrawText(pdf, p, payeeName, xnameoffset, yoffset + 105); DrawText(pdf, p, "**" + String.Format("{0:f}", Amount), 500, yoffset + 107); int amountnodecimals = Convert.ToInt32(Math.Truncate(Amount)); int decimals = Convert.ToInt32((Amount - amountnodecimals) * 100); DrawText(pdf, p, NumberConvertor.NumberToText(amountnodecimals).ToLower() + " dollar(s) " + NumberConvertor.NumberToText(decimals).ToLower() + " cents *****************", 30, yoffset + 130); // draw the mailing address for windowed envelopes string mailingAddress = (payeeAddress == null) ? "" : payeeAddress.ToString(); if (!String.IsNullOrEmpty(mailingAddress)) { string[] addressLines = Regex.Split(mailingAddress, "\r\n"); for (int a = 0; a < addressLines.Length; a++) { DrawText(pdf, p, addressLines[a], 50, yoffset + 155 + (a * 12)); } } // draw the memo DrawText(pdf, p, Memo, 30, yoffset + 215); } pdf.Flush(); bos.Close(); return filepath; }
/** * Draws this RadioButton on the specified Page. * * @param page the Page where the RadioButton is to be drawn. */ public float[] DrawOn(Page page) { page.AddBMC(StructElem.SPAN, language, altDescription, actualText); this.r1 = font.GetAscent()/2; this.r2 = r1/2; this.penWidth = r1/10; float y_box = y - font.GetAscent(); page.SetPenWidth(1f); page.SetPenColor(Color.black); page.SetLinePattern("[] 0"); page.SetBrushColor(Color.black); page.DrawCircle(x + r1, y_box + r1, r1); if (this.selected) { page.DrawCircle(x + r1, y_box + r1, r2, Operation.FILL); } if (uri != null) { page.SetBrushColor(Color.blue); } page.DrawString(font, label, x + 3*r1, y); page.SetPenWidth(0f); page.SetBrushColor(Color.black); page.AddEMC(); if (uri != null) { // Please note: The font descent is a negative number. page.AddAnnotation(new Annotation( uri, null, x + 3*r1, page.height - y, x + 3*r1 + font.StringWidth(label), page.height - (y - font.GetAscent()), language, altDescription, actualText)); } return new float[] { x + 6*r1 + font.StringWidth(label), y + font.GetBodyHeight() }; }
public void DrawOn(Page page) { page.setPenWidth(width); page.SetLinePattern(pattern); page.moveTo(x, y); page.lineTo(x + w, y); page.lineTo(x + w, y + h); page.lineTo(x, y + h); page.closePath(); if (fill_shape) { page.SetBrushColor( color[0], color[1], color[2]); page.fillPath(); } else { page.SetPenColor( color[0], color[1], color[2]); page.strokePath(); } }
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.SetBrushColor(textColor); page.AddEMC(); page.AddBMC(StructElem.SPAN, language, altDescription, actualText); page.SetTextStart(); page.SetTextFont(font); 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 DrawOn(Page p) { if (components.Count > 0) { p.pdf.groups.Add(this); ocgNumber = p.pdf.groups.Count; p.pdf.Newobj(); p.pdf.Append("<<\n"); p.pdf.Append("/Type /OCG\n"); p.pdf.Append("/Name (" + name + ")\n"); p.pdf.Append(">>\n"); p.pdf.Endobj(); objNumber = p.pdf.objNumber; p.Append("/OC /OC"); p.Append(ocgNumber); p.Append(" BDC\n"); foreach (IDrawable component in components) { component.DrawOn(p); } p.Append("\nEMC\n"); } }
private void drawCode39(Page page) { str = "*" + str + "*"; float x = x1; float y = y1; float w = m1 * barHeightFactor; // Barcode width when drawn vertically float h = m1 * barHeightFactor; // Barcode height when drawn horizontally if (direction == LEFT_TO_RIGHT) { for (int i = 0; i < str.Length; i++) { String code = map[str[i]]; if ( code == null ) { throw new Exception("The input string '" + str + "' contains characters that are invalid in a Code39 barcode."); } for (int j = 0; j < 9; j++) { char ch = code[j]; if (ch == 'w') { x += m1; } else if (ch == 'W') { x += m1 * 3; } else if (ch == 'b') { drawVertBar(page, x, y, m1, h); x += m1; } else if (ch == 'B') { drawVertBar(page, x, y, m1 * 3, h); x += m1 * 3; } } x += m1; } if (font != null) { page.DrawString( font, str, x1 + ((x - x1) - font.StringWidth(str))/2, y1 + h + font.body_height); } } else if (direction == TOP_TO_BOTTOM) { for (int i = 0; i < str.Length; i++) { String code = map[str[i]]; if ( code == null ) { throw new Exception("The input string '" + str + "' contains characters that are invalid in a Code39 barcode."); } for (int j = 0; j < 9; j++) { char ch = code[j]; if (ch == 'w') { y += m1; } else if (ch == 'W') { y += 3 * m1; } else if (ch == 'b') { drawHorzBar(page, x, y, m1, h); y += m1; } else if (ch == 'B') { drawHorzBar(page, x, y, 3 * m1, h); y += 3 * m1; } } y += m1; } if (font != null) { page.SetTextDirection(270); page.DrawString( font, str, x - font.body_height, y1 + ((y - y1) - font.StringWidth(str))/2); page.SetTextDirection(0); } } else if (direction == BOTTOM_TO_TOP) { float height = 0.0f; for (int i = 0; i < str.Length; i++) { String code = map[str[i]]; if ( code == null ) { throw new Exception("The input string '" + str + "' contains characters that are invalid in a Code39 barcode."); } for (int j = 0; j < 9; j++) { char ch = code[j]; if (ch == 'w' || ch == 'b') { height += m1; } else if (ch == 'W' || ch == 'B') { height += 3 * m1; } } height += m1; } y += height - m1; for (int i = 0; i < str.Length; i++) { String code = map[str[i]]; for (int j = 0; j < 9; j++) { char ch = code[j]; if (ch == 'w') { y -= m1; } else if (ch == 'W') { y -= 3 * m1; } else if (ch == 'b') { drawHorzBar2(page, x, y, m1, h); y -= m1; } else if (ch == 'B') { drawHorzBar2(page, x, y, 3 * m1, h); y -= 3 * m1; } } y -= m1; } if (font != null) { y = y1 + ( height - m1); page.SetTextDirection(90); page.DrawString( font, str, x + w + font.body_height, y - ((y - y1) - font.StringWidth(str))/2); page.SetTextDirection(0); } } }
private void drawCode128(Page page) { float x = x1; float y = y1; float w = m1; float h = m1; if (direction == TOP_TO_BOTTOM) { w *= barHeightFactor; } else if (direction == LEFT_TO_RIGHT) { h *= barHeightFactor; } List<Int32> list = new List<Int32>(); for (int i = 0; i < str.Length; i++) { char symchar = str[i]; if (symchar < 32) { list.Add(GS1_128.SHIFT); list.Add(symchar + 0x40); // Decimal 64 } else { list.Add(symchar - 0x20); // Decimal 32 } if (list.Count == 48) break; // Maximum number of data characters is 48 } StringBuilder buf = new StringBuilder(); int check_digit = GS1_128.START_B; buf.Append((char) check_digit); for (int i = 0; i < list.Count; i++) { int codeword = list[i]; buf.Append((char) codeword); check_digit += codeword * (i + 1); } check_digit %= GS1_128.START_A; buf.Append((char) check_digit); buf.Append((char) GS1_128.STOP); for (int i = 0; i < buf.Length; i++) { int si = buf[i]; String symbol = GS1_128.TABLE[si].ToString(); for (int j = 0; j < symbol.Length; j++) { int n = symbol[j] - 0x30; if (j%2 == 0) { if (direction == LEFT_TO_RIGHT) { drawVertBar(page, x, y, m1 * n, h); } else if (direction == TOP_TO_BOTTOM) { drawHorzBar(page, x, y, m1 * n, w); } } if (direction == LEFT_TO_RIGHT) { x += n * m1; } else if (direction == TOP_TO_BOTTOM) { y += n * m1; } } } if (font != null) { if (direction == LEFT_TO_RIGHT) { page.DrawString( font, str, x1 + ((x - x1) - font.StringWidth(str))/2, y1 + h + font.body_height); } else if (direction == TOP_TO_BOTTOM) { page.SetTextDirection(90); page.DrawString( font, str, x + w + font.body_height, y - ((y - y1) - font.StringWidth(str))/2); page.SetTextDirection(0); } } }
private void drawBar( Page page, float x, float y, float m1, // Single bar width float h) { page.SetPenWidth(m1); page.MoveTo(x, y); page.LineTo(x, y + h); page.StrokePath(); }
/** * Draws this barcode on the specified page. * * @param page the scecified page. */ public void DrawOn(Page page) { if (type == BarCode.UPC) { drawCodeUPC(page); } else if (type == BarCode.CODE128) { drawCode128(page); } else if (type == BarCode.CODE39) { drawCode39(page); } }
private void DrawYAxisLabels(Page page) { float x = x5 - GetLongestAxisYLabelWidth(); float y = y8 + f2.ascent / 3; float step = (y8 - y5) / y_axis_grid_lines; page.SetBrushColor(Color.black); for (int i = 0; i < (y_axis_grid_lines + 1); i++) { String label = nf.Format( y_min + (y_max - y_min) / y_axis_grid_lines * i); page.DrawString(f2, label, x, y); y -= step; } }
private void drawVertBar( Page page, float x, float y, float m1, // Module length float h) { page.SetPenWidth(m1); page.MoveTo(x + m1/2, y); page.LineTo(x + m1/2, y + h); page.StrokePath(); }
private void drawHorzBar2( Page page, float x, float y, float m1, // Module length float w) { page.SetPenWidth(m1); page.MoveTo(x, y - m1/2); page.LineTo(x + w, y - m1/2); page.StrokePath(); }
private void DrawPathsAndPoints( Page page, List<List<Point>> chartData) { for (int i = 0; i < chartData.Count; i++) { List<Point> points = chartData[i]; Point point = points[0]; if (point.isStartOfPath) { page.SetPenColor(point.color); page.SetPenWidth(point.lineWidth); page.SetLinePattern(point.linePattern); page.DrawPath(points, Operation.STROKE); if (point.GetText() != null) { page.SetBrushColor(point.GetTextColor()); page.SetTextDirection(point.GetTextDirection()); page.DrawString(f2, point.GetText(), point.x, point.y); } } for (int j = 0; j < points.Count; j++) { point = points[j]; if (point.GetShape() != Point.INVISIBLE) { page.SetPenWidth(point.lineWidth); page.SetLinePattern(point.linePattern); page.SetPenColor(point.color); page.SetBrushColor(point.color); page.DrawPoint(point); } } } }
private void DrawVerticalGridLines(Page page) { page.SetPenWidth(v_grid_line_width); page.SetPenColor(Color.black); page.SetLinePattern(v_grid_line_pattern); float x = x5; float y = y5; float step = (x6 - x5) / x_axis_grid_lines; for (int i = 0; i < x_axis_grid_lines; i++) { page.DrawLine(x, y, x, y8); x += step; } }
public int GetNumberOfPages(Page page) { int numOfPages = 1; int j = numOfHeaderRows; double cell_h = 0.0; while (j != tableData.Count) { double y = y1; for (int i = 0; i < numOfHeaderRows; i++) { Cell cell = tableData[i][0]; cell_h = cell.font.body_height + 2 * margin; y += cell_h; } for (; j < tableData.Count; j++) { Cell cell = tableData[j][0]; cell_h = cell.font.body_height + 2 * margin; y += cell_h; if ((y + cell_h) > (page.height - bottom_margin)) { numOfPages++; break; } } } return numOfPages; }
public void DrawOn(Page page) { double x = x1; double y = y1; double cell_w = 0.0; double cell_h = 0.0; page.setPenWidth(lineWidth); page.SetPenColor(lineColor[0], lineColor[1], lineColor[2]); for (int i = 0; i < numOfHeaderRows; i++) { List<Cell> dataRow = tableData[i]; for (int j = 0; j < dataRow.Count; j++) { Cell cell = dataRow[j]; cell_h = cell.font.body_height + 2 * margin; cell_w = cell.width; for (int k = 1; k < cell.colspan; k++) { cell_w += dataRow[++j].width; } page.SetBrushColor( cell.brushColor[0], cell.brushColor[1], cell.brushColor[2]); cell.Paint(page, x, y, cell_w, cell_h, margin); x += cell_w; } x = x1; y += cell_h; } for (int i = rendered; i < tableData.Count; i++) { List<Cell> dataRow = tableData[i]; for (int j = 0; j < dataRow.Count; j++) { Cell cell = dataRow[j]; cell_h = cell.font.body_height + 2 * margin; cell_w = cell.width; for (int k = 1; k < cell.colspan; k++) { cell_w += dataRow[++j].width; } page.SetBrushColor( cell.brushColor[0], cell.brushColor[1], cell.brushColor[2]); cell.Paint(page, x, y, cell_w, cell_h, margin); x += cell_w; } x = x1; y += cell_h; if ((y + cell_h) > (page.height - bottom_margin)) { if (i == tableData.Count - 1) { rendered = -1; } else { rendered = i + 1; } return; } } rendered = -1; }
private void SetTextSkew( Page page, float skew, float x, float y) { page.Append(1f); page.Append(' '); page.Append(0f); page.Append(' '); page.Append(skew); page.Append(' '); page.Append(1f); page.Append(' '); page.Append(x); page.Append(' '); page.Append(page.height - y); page.Append(" Tm\n"); }
/** * Draws this chart on the specified page. * * @param page the page to draw this chart on. */ public void DrawOn(Page page) { nf.SetMinimumFractionDigits(minFractionDigits); nf.SetMaximumFractionDigits(maxFractionDigits); x2 = x1 + w; y2 = y1; x3 = x2; y3 = y1 + h; x4 = x1; y4 = y3; SetMinAndMaxChartValues(); RoundXAxisMinAndMaxValues(); RoundYAxisMinAndMaxValues(); // Draw chart title page.DrawString( f1, title, x1 + ((w - f1.StringWidth(title)) / 2), y1 + 1.5f * f1.body_height); float top_margin = 2.5f * f1.body_height; float left_margin = GetLongestAxisYLabelWidth() + 2f * f2.body_height; float right_margin = 2f * f2.body_height; float bottom_margin = 2.5f * f2.body_height; x5 = x1 + left_margin; y5 = y1 + top_margin; x6 = x2 - right_margin; y6 = y5; x7 = x6; y7 = y3 - bottom_margin; x8 = x5; y8 = y7; DrawChartBorder(page); DrawInnerBorder(page); DrawHorizontalGridLines(page); DrawVerticalGridLines(page); if (drawXAxisLabels) { DrawXAxisLabels(page); } if (drawYAxisLabels) { DrawYAxisLabels(page); } // Translate the point coordinates for (int i = 0; i < chartData.Count; i++) { List<Point> points = chartData[i]; for (int j = 0; j < points.Count; j++) { Point point = points[j]; point.x = x5 + (point.x - x_min) * (x6 - x5) / (x_max - x_min); point.y = y8 - (point.y - y_min) * (y8 - y5) / (y_max - y_min); if (point.GetURIAction() != null) { page.AddAnnotation(new Annotation( point.GetURIAction(), null, point.x - point.r, page.height - (point.y - point.r), point.x + point.r, page.height - (point.y + point.r), null, null, null)); } } } DrawPathsAndPoints(page, chartData); // Draw the Y axis title page.SetBrushColor(Color.black); page.SetTextDirection(90); page.DrawString( f2, y_axis_title, x1 + f2.body_height, y8 - ((y8 - y5) - f2.StringWidth(y_axis_title)) / 2); // Draw the X axis title page.SetTextDirection(0); page.DrawString( f2, x_axis_title, x5 + ((x6 - x5) - f2.StringWidth(x_axis_title)) / 2, y4 - f2.body_height / 2); page.SetDefaultLineWidth(); page.SetDefaultLinePattern(); page.SetPenColor(Color.black); }
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); } }
private float drawEGuard( Page page, float x, float y, float m1, float h) { // 101 drawBar(page, x + (0.5f * m1), y, m1, h); drawBar(page, x + (2.5f * m1), y, m1, h); return (x + (3.0f * m1)); }
private void drawBar( Page page, float x, float y, float w, // Bar width float h) { page.SetPenWidth(w); page.MoveTo(x + w/2, y); page.LineTo(x + w/2, y + h); page.StrokePath(); }
private float drawMGuard( Page page, float x, float y, float m1, float h) { // 01010 drawBar(page, x + (1.5f * m1), y, m1, h); drawBar(page, x + (3.5f * m1), y, m1, h); return (x + (5.0f * m1)); }
private void DrawPdf417(Page page) { float x = x1; float y = y1; int[] start_symbol = {8, 1, 1, 1, 1, 1, 1, 3}; for (int i = 0; i < start_symbol.Length; i++) { int n = start_symbol[i]; if (i%2 == 0) { drawBar(page, x, y, n * w1, rows * h1); } x += n * w1; } x1 = x; int k = 1; // Cluster index for (int i = 0; i < codewords.Length; i++) { int row = codewords[i]; String symbol = PDF417.TABLE[row,k].ToString(); for (int j = 0; j < 8; j++) { int n = symbol[j] - 0x30; if (j%2 == 0) { drawBar(page, x, y, n * w1, h1); } x += n * w1; } if (i == codewords.Length - 1) break; if ((i + 1) % (cols + 2) == 0) { x = x1; y += h1; k++; if (k == 4) k = 1; } } y = y1; int[] end_symbol = {7, 1, 1, 3, 1, 1, 1, 2, 1}; for (int i = 0; i < end_symbol.Length; i++) { int n = end_symbol[i]; if (i%2 == 0) { drawBar(page, x, y, n * w1, rows * h1); } x += n * w1; } }
/** * Draws this barcode on the specified page. * * @param page the page to draw this barcode on. */ public void DrawOn(Page page) { DrawPdf417(page); }
private void DrawXAxisLabels(Page page) { float x = x5; float y = y8 + f2.body_height; float step = (x6 - x5) / x_axis_grid_lines; page.SetBrushColor(Color.black); for (int i = 0; i < (x_axis_grid_lines + 1); i++) { String label = nf.Format( x_min + (x_max - x_min) / x_axis_grid_lines * i); page.DrawString( f2, label, x - (f2.StringWidth(label) / 2), y); x += step; } }