private void CriarPaginaDoVerso() { // Create page to place the PDF page = new ceTe.DynamicPDF.Page(1404, 2000, 1); ceTe.DynamicPDF.PageElements.Label lbl1 = new ceTe.DynamicPDF.PageElements.Label(T_Unicode(cab1), 1404 - intMargem, 1940, 700, 35); // Nome do condomínio ceTe.DynamicPDF.PageElements.Label lbl6 = new ceTe.DynamicPDF.PageElements.Label(func1, 1404 - intMargem, 1980, 500, 35); // Nome do funcionário ceTe.DynamicPDF.PageElements.Label lblTipo = new ceTe.DynamicPDF.PageElements.Label(" ", 700, 35, 400, 50); foreach (int indexChecked in checkedListBoxMSGTipoPagamento.CheckedIndices) { // The indexChecked variable contains the index of the item. lblTipo = new ceTe.DynamicPDF.PageElements.Label(checkedListBoxMSGTipoPagamento.Items[indexChecked].ToString() + " Referênte à " + T_Unicode(cab4) + "/" + cab5, 1404 - intMargem, 1900, 700, 35); // Tipo de Pagamento } lbl1.FontSize = 16; lbl6.FontSize = 16; lblTipo.FontSize = 16; lbl1.Angle = 180; lbl6.Angle = 180; lblTipo.Angle = 180; page.Elements.Add(lbl1); page.Elements.Add(lbl6); page.Elements.Add(lblTipo); document.Pages.Add(page); }
private static string BarcodeJobTicketPdf(string FullFileName, string JobName, string StockCode) { string pdfFullName = FullFileName.Replace(" .pdf", ".pdf"); ceTe.DynamicPDF.Document.AddLicense("DPS70NEDJGMGEGWKOnLLQb4SjhbTTJhXnkpf9bj8ZzxFH+FFxctoPX+HThGxkpidUCHJ5b88fg4oUJSHiRBggzHdghUgkkuIvoag"); var doc = new ceTe.DynamicPDF.Document(); var page = new ceTe.DynamicPDF.Page(); MergeDocument MyDocJobTicket = new MergeDocument(); PdfDocument pdfTemplate = new PdfDocument(FullFileName); var qrCode = new ceTe.DynamicPDF.PageElements.Image(Encode.QR(JobName), 300, 50); qrCode.Height = 90; qrCode.Width = 90; MyDocJobTicket.Append(pdfTemplate); MyDocJobTicket.Pages[0].Dimensions.SetMargins(0); MyDocJobTicket.Pages[0].Elements.Add(qrCode); qrCode = new ceTe.DynamicPDF.PageElements.Image(Encode.QR(StockCode), 50, 405); qrCode.Height = 38; qrCode.Width = 38; MyDocJobTicket.Pages[0].Elements.Add(qrCode); MyDocJobTicket.FormFlattening = FormFlatteningOptions.Default; MyDocJobTicket.Draw(pdfFullName); MyDocJobTicket = null; FileInfo fi = new FileInfo(FullFileName); fi.Delete(); return(pdfFullName); }
private void AddNewPage(Document document) { // Adds a new page to the document currentPage = new Page(pageDimensions); CURRENT_Y = bodyTop; alternateBG = false; document.Pages.Add(currentPage); }
private void AddNewPage(Document document) { // Adds a new page to the document currentPage = new ceTe.DynamicPDF.Page(pageDimensions); currentY = bodyTop; alternateBG = false; document.Pages.Add(currentPage); }
private static void ShowErrorDocument(string message, string stackTrace) { // Shows the error in a PDF document Document document = new Document(); ceTe.DynamicPDF.Page page = new ceTe.DynamicPDF.Page(PageSize.Letter, PageOrientation.Portrait); TextArea messageArea = new TextArea(message, 0, 0, 512, 36, Font.Helvetica, 18, RgbColor.Red); messageArea.Height = messageArea.GetRequiredHeight(); page.Elements.Add(messageArea); if (stackTrace.Trim().Length > 0) { float stackTraceTop = messageArea.Y + messageArea.Height + 20; TextArea stackTraceTA = new TextArea(stackTrace, 0, stackTraceTop, 512, 692 - stackTraceTop, Font.Helvetica, 10); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("StackTrace:", 0, stackTraceTop - 12, 512, 12, Font.HelveticaBold, 10)); page.Elements.Add(stackTraceTA); } document.Pages.Add(page); document.Draw(); }
public static void Run(string outputPdfPath) { // Create a document and set it's properties ceTe.DynamicPDF.Document document = new ceTe.DynamicPDF.Document(); document.Creator = "USEnvelope.aspx"; document.Author = "ceTe Software"; document.Title = "US Envelope"; // Create a page and add it to the document. ceTe.DynamicPDF.Page page = new ceTe.DynamicPDF.Page(PageSize.Envelope10, PageOrientation.Landscape, 18); document.Pages.Add(page); // Uncomment the line below to show a layout grid. //page.Elements.Add( new LayoutGrid() ); // Add page elements to the page page.Elements.Add(new Image(Util.GetResourcePath("Images/DPDFLogo.png"), 0, 2, 0.16f)); page.Elements.Add(new TextArea(GetFromAddress(), 50, 0, 350, 80, Font.Helvetica, 10)); page.Elements.Add(new TextArea(GetToAddress(), 300, 140, 360, 100, Font.Helvetica, 12)); // Check for an error try { document.Draw(outputPdfPath); } catch (InvalidValueBarCodeException) { // Show the Postnet value error ShowErrorDocument("Invalid To Zipcode. To zipcode must be a valid US zipcode.", ""); } catch (Exception excGeneral) { // Show a general error ShowErrorDocument(excGeneral.Message, excGeneral.StackTrace); } }
public bool MakePdf(Tour current_tour) { try { //PDF generator ceTe.DynamicPDF.Document document = new ceTe.DynamicPDF.Document(); Page page = new Page(ceTe.DynamicPDF.PageSize.Letter, PageOrientation.Portrait, 54.0f); document.Pages.Add(page); string labelText = " " + current_tour.Name; Label label = new Label(labelText, 0, 0, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 18, TextAlign.Center); page.Elements.Add(label); string labelText2 = "#" + current_tour.UUID; Label label2 = new Label(labelText2, 0, 25, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 18, TextAlign.Center); page.Elements.Add(label2); string labelText3 = "_________________________________________________"; Label label3 = new Label(labelText3, 0, 50, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 18, TextAlign.Center); page.Elements.Add(label3); string labelText4 = "From " + current_tour.From; Label label4 = new Label(labelText4, 0, 75, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Center); page.Elements.Add(label4); string labelText5 = "to " + current_tour.To; Label label5 = new Label(labelText5, 0, 100, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Center); page.Elements.Add(label5); string labelText6 = "____________________"; Label label6 = new Label(labelText6, 0, 110, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 18, TextAlign.Center); page.Elements.Add(label6); Image image = new Image(current_tour.PicPath, 115, 504); page.Elements.Add(image); int i = 1; string string_schleife = ""; Label label_schleife; if (current_tour.LogItems != null) { foreach (Log log in current_tour.LogItems) { int y = 130; Page page2 = new Page(ceTe.DynamicPDF.PageSize.Letter, PageOrientation.Portrait, 54.0f); document.Pages.Add(page2); string_schleife = "Log " + i; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 10; string_schleife = "_________"; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "UUID: " + log.UUID; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Date: " + log.Date_Time; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Distance: " + log.Distance; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Total Time: " + log.TotalTime; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Report: " + log.Report; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Rating: " + log.Rating; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Avarage Speed: " + log.AvarageSpeed; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Comment: " + log.Comment; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Problems: " + log.Problems; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Transport Mode: " + log.TransportModus; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "Recomendation " + log.Recomended; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; string_schleife = "______________________________________________________________"; label_schleife = new Label(string_schleife, 0, y, 504, 100, ceTe.DynamicPDF.Font.Helvetica, 14, TextAlign.Left); page2.Elements.Add(label_schleife); y += 20; i++; } } document.Draw(this.to_pdf + current_tour.Name + "_" + current_tour.UUID + ".pdf"); return(true); } catch (Exception e) { string exception = "{\"errorMessages\":[\"" + e.Message.ToString() + "\"],\"errors\":{}}"; log.Error(exception, e); return(false); } }
public static void Run(string outputPdfPath) { // Create a MergeOptions object to import the AcroForm MergeOptions options = new MergeOptions(false); // Create a document and set it's properties MergeDocument document = new MergeDocument(Util.GetResourcePath("PDFs/fw9_18.pdf"), options); document.Creator = "FormFill.aspx"; document.Author = "ceTe Software"; document.Title = "W-9 Form Filler"; // Get the imorted page and set margins. ceTe.DynamicPDF.Page page = document.Pages[0]; page.Dimensions.SetMargins(41, 35, 45, 37); // Uncomment the line below to show a layout grid. //page.Elements.Add( new LayoutGrid() ); // Add page elements to the page page.Elements.Add(new Label("Alex B", 20, 60, 490, 12, Font.Courier, 9)); page.Elements.Add(new Label("Smith", 20, 84, 490, 12, Font.Courier, 9)); page.Elements.Add(new Label("3", 27, 125, 20, 12, Font.ZapfDingbats, 6)); page.Elements.Add(new Label("123 Main Street", 20, 215, 300, 12, Font.Courier, 9)); page.Elements.Add(new Label("Washington, DC 22222", 20, 240, 300, 12, Font.Courier, 9)); page.Elements.Add(new Label("Enna Mark", 350, 215, 170, 36, Font.Courier, 9)); page.Elements.Add(new Label("11998728719", 20, 265, 160, 12, Font.Courier, 9)); string ssn = "521234567".Trim().Replace("-", "").Replace(" ", ""); string ein = "52123".Trim().Replace("-", "").Replace(" ", ""); if (ssn.Length >= 9) { page.Elements.Add(new Label(ssn.Substring(0, 1), 375, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(1, 1), 391.4f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(2, 1), 405.8f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(3, 1), 433.2f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(4, 1), 447.6f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(5, 1), 475.4f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(6, 1), 490.8f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(7, 1), 505.2f, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ssn.Substring(8, 1), 520, 307, 14, 12, Font.Courier, 9, TextAlign.Center)); } else if (ein.Length >= 9) { page.Elements.Add(new Label(ein.Substring(0, 1), 376, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(1, 1), 391.4f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(2, 1), 418.8f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(3, 1), 433.2f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(4, 1), 447.6f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(5, 1), 462, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(6, 1), 476.4f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(7, 1), 490.8f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); page.Elements.Add(new Label(ein.Substring(8, 1), 505.2f, 355, 14, 12, Font.Courier, 9, TextAlign.Center)); } // Outputs the W-9 to the current web page document.Draw(outputPdfPath); }
private void CriarNovaPagina() { // Create page to place the imported PDF page = new ceTe.DynamicPDF.Page(1404, 1404, 0); intHolerite++; this.btnCriar.Text = Convert.ToString(intHolerite); // Parte de cima // Add rectangles to show dimensions of original page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 1, 1100, 200)); // Primeiro BOX page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(950, 570, 150, 30)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 120, 1100, 450)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 200, 1100, 15)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 200, 100, 400)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(100, 200, 600, 400)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800, 200, 150, 400)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1, 600, 1100, 600)); // Linha dos Totais page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800, 600, 150, 30)); // Mensagem Valor Líquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(950, 600, 150, 30)); // Valor Líquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 630, 1100, 30)); // Bases // Cabeçalho das verbas ceTe.DynamicPDF.PageElements.Label lblVerbas1 = new ceTe.DynamicPDF.PageElements.Label("CÓD.", 5, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas2 = new ceTe.DynamicPDF.PageElements.Label("DESCRIÇÃO", 150, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas3 = new ceTe.DynamicPDF.PageElements.Label("REF.", 710, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas4 = new ceTe.DynamicPDF.PageElements.Label("VECIMENTOS", 810, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas5 = new ceTe.DynamicPDF.PageElements.Label("DESCONTOS", 960, 203, 800, 80); page.Elements.Add(lblVerbas1); page.Elements.Add(lblVerbas2); page.Elements.Add(lblVerbas3); page.Elements.Add(lblVerbas4); page.Elements.Add(lblVerbas5); // Propaganda ceTe.DynamicPDF.PageElements.Label lblp1 = new ceTe.DynamicPDF.PageElements.Label("facilitari.com", 1, 660, 800, 80); ceTe.DynamicPDF.PageElements.Label lblp2 = new ceTe.DynamicPDF.PageElements.Label("facilitari.com", 1, 660 + intLinha, 800, 80); page.Elements.Add(lblp1); page.Elements.Add(lblp2); // Separação via empregador, via empregado page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1, 680, 1100, 680)); // Linha de separação // Recibo do Empregado ceTe.DynamicPDF.PageElements.Label lblRecibo1 = new ceTe.DynamicPDF.PageElements.Label("DECLARO TER RECEBIDO A IMPORTÂNCIA LIQUÍDA DISCRIMINADA NESSE RECIBO", 1120, 510, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo2 = new ceTe.DynamicPDF.PageElements.Label("_____/_____/_____ ____________________________________", 1150, 510, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo3 = new ceTe.DynamicPDF.PageElements.Label(" Data Assinatura ", 1180, 510, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo4 = new ceTe.DynamicPDF.PageElements.Label(" VIA EMPREGADOR ", 1200, 510, 800, 80); lblRecibo1.Angle = -90; lblRecibo2.Angle = -90; lblRecibo3.Angle = -90; lblRecibo4.Angle = -90; lblRecibo4.FontSize = 16; page.Elements.Add(lblRecibo1); page.Elements.Add(lblRecibo2); page.Elements.Add(lblRecibo3); page.Elements.Add(lblRecibo4); // Recibo do empregador ceTe.DynamicPDF.PageElements.Label lblRecibo5 = new ceTe.DynamicPDF.PageElements.Label("DECLARO TER RECEBIDO A IMPORTÂNCIA LIQUÍDA DISCRIMINADA NESSE RECIBO", 1120, 1260, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo6 = new ceTe.DynamicPDF.PageElements.Label("_____/_____/_____ ____________________________________", 1150, 1260, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo7 = new ceTe.DynamicPDF.PageElements.Label(" Data Assinatura ", 1180, 1260, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo8 = new ceTe.DynamicPDF.PageElements.Label(" VIA EMPREGADO", 1200, 1260, 800, 80); lblRecibo5.Angle = -90; lblRecibo6.Angle = -90; lblRecibo7.Angle = -90; lblRecibo8.Angle = -90; lblRecibo8.FontSize = 16; page.Elements.Add(lblRecibo5); page.Elements.Add(lblRecibo6); page.Elements.Add(lblRecibo7); page.Elements.Add(lblRecibo8); // Parte de baixo // Add rectangles to show dimensions of original page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 1 + intLinha, 1100, 200)); // Primeiro BOX page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(950, 570 + intLinha, 150, 30)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 120 + intLinha, 1100, 450)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 200 + intLinha, 1100, 15)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 200 + intLinha, 100, 400)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(100, 200 + intLinha, 600, 400)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800, 200 + intLinha, 150, 400)); page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1, 600 + intLinha, 900, 600 + intLinha)); // Linha dos Totais page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800, 600 + intLinha, 150, 30)); // Mensagem Valor Líquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(950, 600 + intLinha, 150, 30)); // Valor Líquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1, 630 + intLinha, 1100, 30)); // Bases // Cabeçalho das verbas ceTe.DynamicPDF.PageElements.Label lblVerbas21 = new ceTe.DynamicPDF.PageElements.Label("CÓD.", 5, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas22 = new ceTe.DynamicPDF.PageElements.Label("DESCRIÇÃO", 150, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas23 = new ceTe.DynamicPDF.PageElements.Label("REF.", 710, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas24 = new ceTe.DynamicPDF.PageElements.Label("VECIMENTOS", 810, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas25 = new ceTe.DynamicPDF.PageElements.Label("DESCONTOS", 960, 203 + intLinha, 800, 80); page.Elements.Add(lblVerbas21); page.Elements.Add(lblVerbas22); page.Elements.Add(lblVerbas23); page.Elements.Add(lblVerbas24); page.Elements.Add(lblVerbas25); }
/// <summary> /// Add a Barcode to the PDF page /// </summary> /// <param name="objCurrentPage">current ceTe page to add to</param> /// <param name="strBarcode">barcode string</param> /// <param name="blnFlat"></param> /// <param name="blnAddressPage"></param> private static void AddBarCode(ref ceTe.DynamicPDF.Page objCurrentPage, string strBarcode, bool blnFlat, bool blnAddressPage) { var log = new clsLog(); //set up barcode ceTe.DynamicPDF.Text.OpenTypeFont MyFont; try { string strFontName = ""; float flX; float flY; float flFontSize; if (blnFlat == true) { if (blnAddressPage == true) { flX = 180; flY = 705; } else { flX = 180; flY = 755; } flFontSize = 36.0F; } else { if (blnAddressPage == true) { flX = 0; flY = 197; } else { flX = 0; flY = 227; } flFontSize = 40.0F; } //set up barcode ceTe.DynamicPDF.PageElements.Forms.TextField MyBarcodeBack = new ceTe.DynamicPDF.PageElements.Forms.TextField("BarcodeBack", flX, flY - 15, 290, 50); MyBarcodeBack.TextAlign = Align.Center; MyBarcodeBack.BackgroundColor = RgbColor.White; MyBarcodeBack.DefaultValue = ""; ceTe.DynamicPDF.PageElements.Forms.TextField MyBarcode = new ceTe.DynamicPDF.PageElements.Forms.TextField("Barcode", flX, flY, 250, 40); MyBarcode.TextAlign = Align.Center; //if (strFontName != "Code3903.TTF") //{ // strFontName = "C3903.TTF"; //} strFontName = "C3903.TTF"; //if (IsFontInstalled(strFontName) == false) //{ // strFontName = "C3903.TTF"; // log.WriteToLogfile("IsFontInstalled(strFontName) = false" + strFontName); //} if (blFoundFont == false) { strFontName = "Code3903.TTF"; } try { MyFont = new ceTe.DynamicPDF.Text.OpenTypeFont(strFontName); } catch { blFoundFont = false; //strFontName = "C3903.TTF"; strFontName = "Code3903.TTF"; MyFont = new ceTe.DynamicPDF.Text.OpenTypeFont(strFontName); } MyBarcode.BackgroundColor = RgbColor.White; //MyBarcode.BorderStyle = ceTe.DynamicPDF.PageElements.Forms.BorderStyle.Solid; MyBarcode.Font = MyFont; MyBarcode.FontSize = flFontSize; if (blnFlat == false) { MyBarcode.Rotate = 90; MyBarcodeBack.Rotate = 90; } //set text equal to first barcode MyBarcode.DefaultValue = "*" + strBarcode + "*"; //add barcode to page objCurrentPage.Elements.Add(MyBarcodeBack); objCurrentPage.Elements.Add(MyBarcode); if (blnFlat == true) { if (blnAddressPage == true) { flX = 200; //flY = 702; flY = 699; } else { flX = 200; //flY = 752; flY = 749; } } else { if (blnAddressPage == true) { flX = 40; flY = 225; } else { flX = 40; flY = 255; } } //Create readable barcode ceTe.DynamicPDF.PageElements.Forms.TextField MyreadableBarcode = new ceTe.DynamicPDF.PageElements.Forms.TextField("Barcode2", flX, flY, 200, 8); MyreadableBarcode.TextAlign = Align.Center; MyreadableBarcode.BackgroundColor = RgbColor.White; //MyreadableBarcode.BorderStyle = ceTe.DynamicPDF.PageElements.Forms.BorderStyle.Solid; ceTe.DynamicPDF.Text.OpenTypeFont MyFont2 = new ceTe.DynamicPDF.Text.OpenTypeFont("Times.TTF"); MyreadableBarcode.Font = MyFont2; MyreadableBarcode.FontSize = 6; if (blnFlat == false) { MyreadableBarcode.Rotate = 270; } //set text equal to first barcode MyreadableBarcode.DefaultValue = "*" + strBarcode + "*"; //add readable barcode to page objCurrentPage.Elements.Add(MyreadableBarcode); } catch (Exception ex) { throw new ApplicationException("Error creating WC report // AddBarCode", ex); } }
/// <summary> /// Create WC letter /// </summary> /// <param name="dr">data row of WC letter</param> private static void CreateWCReport(DataRow dr) { try { ceTe.DynamicPDF.Document.AddLicense(ceTeLicense); //string strIndiviualPDFPath = "\\\\Cobmain\\USACMS\\PODFO\\Output\\IndividualPDFs\\"; //string strPODProcessFolder = "\\\\Cobmain\\USACMS\\PODFO\\Downloads\\WC_ZIPFILES\\PROCESSED\\"; string strMpresortID = Convert.ToString((Int32)dr["MPresortID"]); string strRun = (string)dr["PODRunID"]; string strBatchRun = Convert.ToString((decimal)dr["PODBatchID"]) + (string)dr["PODRunID"]; string strFileName = strIndiviualPDFPath + strBatchRun + "\\\\" + strMpresortID.PadLeft(8, '0') + ".PDF"; string strBarcode = (string)dr["BarCodes"]; string[] strBarcodes = strBarcode.Split(','); int intPDFPageCount; int intEvenPages; int intBarCode; string strZipFileID = Convert.ToString((decimal)dr["PODWCZipFileID"]); string strPDFName = (string)dr["LETTER_FILENAME"]; string strPDFNameandPath = strPODProcessFolder + strZipFileID + "-" + strPDFName.Trim() + ".pdf"; if (File.Exists(strPDFNameandPath)) { ceTe.DynamicPDF.Merger.MergeDocument pdf = new ceTe.DynamicPDF.Merger.MergeDocument(strPDFNameandPath); intPDFPageCount = pdf.Pages.Count - 1; //get Address Page ceTe.DynamicPDF.Page CurrentPage = pdf.Pages[0]; CurrentPage.Dimensions.LeftMargin = 2; if (strRun == "01") { AddBarCode(ref CurrentPage, strBarcodes[0], false, true); } else { AddBarCode(ref CurrentPage, strBarcodes[0], true, true); } //set up address string string strAddress; string strEndorse = (string)dr["MEndorse"]; //.ToString.Replace("*", "") string strKeyline = (string)dr["MKeyLine"]; string strTray = Convert.ToString((Int32)dr["MTray"]); string strPackage = Convert.ToString((Int32)dr["MPackage"]); string strPageCount = Convert.ToString((decimal)dr["PageCount"]); string strPresortID = Convert.ToString((Int32)dr["MPresortID"]); strEndorse = strKeyline + System.Environment.NewLine + "***" + strEndorse.Replace("*", "").Trim() + " R:" + strPresortID + " T:" + strTray + " P:" + strPackage + " PC:" + strPageCount + " F: " + strBatchRun; strAddress = strEndorse + System.Environment.NewLine; strAddress = strAddress + (string)dr["mailname"] + System.Environment.NewLine; strAddress = strAddress + (string)dr["SatoriAdd1"] + System.Environment.NewLine; //CHECK SECOND ADDRESS LINE string strAdd2 = (string)dr["SatoriAdd2"]; if (strAdd2.Trim().Length > 0) { strAddress = strAddress + strAdd2 + System.Environment.NewLine; } //ADD CITY STATE ZIP strAddress = strAddress + (string)dr["SatoriCityStateZip"] + System.Environment.NewLine; if (strRun == "01") { //create address label ceTe.DynamicPDF.PageElements.Label MyAddressLabel = new ceTe.DynamicPDF.PageElements.Label(strAddress, 80, 90, 612, 70, ceTe.DynamicPDF.Font.TimesRoman, 10, TextAlign.Left); CurrentPage.Elements.Add(MyAddressLabel); //ADD IMB ceTe.DynamicPDF.PageElements.BarCoding.IntelligentMailBarCode IMBBarcode = new ceTe.DynamicPDF.PageElements.BarCoding.IntelligentMailBarCode((string)dr["MBarcodeNumber"], 80, 80); CurrentPage.Elements.Add(IMBBarcode); } else { ceTe.DynamicPDF.PageElements.Label MyAddressLabel = new ceTe.DynamicPDF.PageElements.Label(strAddress, 320, 100, 612, 70, ceTe.DynamicPDF.Font.TimesRoman, 10, TextAlign.Left); CurrentPage.Elements.Add(MyAddressLabel); //ADD IMB ceTe.DynamicPDF.PageElements.BarCoding.IntelligentMailBarCode IMBBarcode = new ceTe.DynamicPDF.PageElements.BarCoding.IntelligentMailBarCode((string)dr["MBarcodeNumber"], 320, 169); CurrentPage.Elements.Add(IMBBarcode); } //add barcode to remaining pages for (intEvenPages = 2; intEvenPages < intPDFPageCount; intEvenPages += 2) { intBarCode = intEvenPages / 2; //add barcode CurrentPage = pdf.Pages[intEvenPages]; if (strRun == "01") { AddBarCode(ref CurrentPage, strBarcodes[intBarCode], false, false); } else { AddBarCode(ref CurrentPage, strBarcodes[intBarCode], true, false); } } // pdf.Pages.Add(blankPage) pdf.FormFlattening = ceTe.DynamicPDF.Merger.FormFlatteningOptions.Default; pdf.CompressionLevel = 0; pdf.PdfVersion = ceTe.DynamicPDF.PdfVersion.v1_3; PDFtime.Start(); pdf.Draw(strFileName); PDFtime.Stop(); pdf = null; CurrentPage = null; }//file exits check else { fileNotFoundCount++; } } catch (Exception ex) { throw new ApplicationException("clsGenerateLettersWC.CreateWCReport " + ex.Message); } }
private void CriarNovaPagina() { // Create page to place the PDF page = new ceTe.DynamicPDF.Page(1404, 2100, 1); intHolerite++; this.btnCriar.Text = "Gerei " + Convert.ToString(intHolerite) + " Holerites."; // Parte de cima // Add rectangles to show dimensions of original page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1 + intMargem, 3 + intMargemSuperior, 1160, 220 + intMargemSuperior)); // Primeiro BOX page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1 + intMargem, 120, 1160, 790)); // BOX do corpo page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(50 + intMargem, 200, 50 + intMargem, 810)); // Linha das referências vertical page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1 + intMargem, 810, 890, 810)); // Linha do final das verbas page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(710 + intMargem, 202, 710 + intMargem, 870)); // Linha vertical da referências page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1 + intMargem, 200, 1160 + intMargem, 200)); // Linha Cabeçalho page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800 + intMargem, 810, 361, 31)); // Box valor liquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800 + intMargem, 200, 150, 670)); // Mensagem Valor Líquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1161 + intMargem, 3, 125, 907)); // Recibo page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1 + intMargem, 870, 1160, 40)); // Box dos Totais // Cabeçalho das verbas ceTe.DynamicPDF.PageElements.Label lblVerbas1 = new ceTe.DynamicPDF.PageElements.Label("CÓD.", 5 + intMargem, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas2 = new ceTe.DynamicPDF.PageElements.Label("DESCRIÇÃO", 370 + intMargem, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas3 = new ceTe.DynamicPDF.PageElements.Label("REF.", 730 + intMargem, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas4 = new ceTe.DynamicPDF.PageElements.Label("VENCIMENTOS", 810 + intMargem, 203, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas5 = new ceTe.DynamicPDF.PageElements.Label("DESCONTOS", 980 + intMargem, 203, 800, 80); lblVerbas1.FontSize = 16; lblVerbas2.FontSize = 16; lblVerbas3.FontSize = 16; lblVerbas4.FontSize = 16; lblVerbas5.FontSize = 16; page.Elements.Add(lblVerbas1); page.Elements.Add(lblVerbas2); page.Elements.Add(lblVerbas3); page.Elements.Add(lblVerbas4); page.Elements.Add(lblVerbas5); // Suporte ceTe.DynamicPDF.PageElements.Label lblp1 = new ceTe.DynamicPDF.PageElements.Label("MiliuApps.com", 10 + intMargem, 910, 800, 5); ceTe.DynamicPDF.PageElements.Label lblp2 = new ceTe.DynamicPDF.PageElements.Label("MiliuApps.com", 10 + intMargem, 910 + intLinha, 800, 5); page.Elements.Add(lblp1); page.Elements.Add(lblp2); // Recibo do Empregador ceTe.DynamicPDF.PageElements.Label lblr1 = new ceTe.DynamicPDF.PageElements.Label("DECLARO TER RECEBIDO A IMPORTÂNCIA LIQUÍDA DISCRIMINADA NESTE RECIBO", 1180 + intMargem, 770, 800, 80); lblr1.FontSize = 16; ceTe.DynamicPDF.PageElements.Label lblRecibo1 = lblr1; ceTe.DynamicPDF.PageElements.Label lblRecibo2 = new ceTe.DynamicPDF.PageElements.Label("..................../..................../.................... ..............................................................................................................", 1225 + intMargem, 760, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo3 = new ceTe.DynamicPDF.PageElements.Label(" Data Assinatura", 1248 + intMargem, 760, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo4 = new ceTe.DynamicPDF.PageElements.Label(" VIA EMPREGADOR", 1262 + intMargem, 730, 800, 80); lblRecibo1.Angle = -90; lblRecibo2.Angle = -90; lblRecibo3.Angle = -90; lblRecibo4.Angle = -90; lblRecibo4.FontSize = 15; page.Elements.Add(lblRecibo1); page.Elements.Add(lblRecibo2); page.Elements.Add(lblRecibo3); page.Elements.Add(lblRecibo4); // Recibo do empregado ceTe.DynamicPDF.PageElements.Label lblr5 = new ceTe.DynamicPDF.PageElements.Label("DECLARO TER RECEBIDO A IMPORTÂNCIA LIQUÍDA DISCRIMINADA NESTE RECIBO", 1180 + intMargem, 770 + intLinha, 800, 80); lblr5.FontSize = 16; ceTe.DynamicPDF.PageElements.Label lblRecibo5 = lblr5; ceTe.DynamicPDF.PageElements.Label lblRecibo6 = new ceTe.DynamicPDF.PageElements.Label("..................../..................../.................... ..............................................................................................................", 1230 + intMargem, 790 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo7 = new ceTe.DynamicPDF.PageElements.Label(" Data Assinatura", 1248 + intMargem, 760 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblRecibo8 = new ceTe.DynamicPDF.PageElements.Label(" VIA EMPREGADO", 1262 + intMargem, 730 + intLinha, 800, 80); lblRecibo5.Angle = -90; lblRecibo6.Angle = -90; lblRecibo7.Angle = -90; lblRecibo8.Angle = -90; lblRecibo8.FontSize = 15; page.Elements.Add(lblRecibo5); page.Elements.Add(lblRecibo6); page.Elements.Add(lblRecibo7); page.Elements.Add(lblRecibo8); // Parte de baixo // Add rectangles to show dimensions of original page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1 + intMargem, 3 + intLinha, 1160, 220)); // Primeiro BOX page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1 + intMargem, 120 + intLinha, 1160, 790)); // BOX do corpo page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(50 + intMargem, 200 + intLinha, 50 + intMargem, 810 + intLinha)); // Linha das referências vertical page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1 + intMargem, 810 + intLinha, 890, 810 + intLinha)); // Linha do final das verbas page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(710 + intMargem, 202 + intLinha, 710 + intMargem, 870 + intLinha)); // Linha vertical da referências page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(1 + intMargem, 200 + intLinha, 1160 + intMargem, 200 + intLinha)); // Linha Cabeçalho page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800 + intMargem, 810 + intLinha, 361, 31)); // Box valor liquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800 + intMargem, 200 + intLinha, 150, 670)); // Mensagem Valor Líquido page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(800 + intMargem, 840 + intLinha, 361, 31)); // Bases page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1161 + intMargem, 3 + intLinha, 125, 907)); // Recibo page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(1 + intMargem, 870 + intLinha, 1160, 40)); // Box dos Totais // Cabeçalho das verbas ceTe.DynamicPDF.PageElements.Label lblVerbas21 = new ceTe.DynamicPDF.PageElements.Label("CÓD.", 5 + intMargem, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas22 = new ceTe.DynamicPDF.PageElements.Label("DESCRIÇÃO", 370 + intMargem, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas23 = new ceTe.DynamicPDF.PageElements.Label("REF.", 730 + intMargem, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas24 = new ceTe.DynamicPDF.PageElements.Label("VENCIMENTOS", 810 + intMargem, 203 + intLinha, 800, 80); ceTe.DynamicPDF.PageElements.Label lblVerbas25 = new ceTe.DynamicPDF.PageElements.Label("DESCONTOS", 980 + intMargem, 203 + intLinha, 800, 80); page.Elements.Add(lblVerbas21); page.Elements.Add(lblVerbas22); page.Elements.Add(lblVerbas23); page.Elements.Add(lblVerbas24); page.Elements.Add(lblVerbas25); }
protected void Page_Load(object sender, EventArgs e) { //this.xops = (ExportOpsBeta)Session["PDFExport"]; this.xops = (ExportOps)Session["PDFExport"]; //ArrayList Pages = xops.Pages; //ArrayList Headers = xops.Headers; //ArrayList Pictures = xops.Pictures; ArrayList Pages = xops.PDFDocumentPages; ArrayList OverFlowPages = new ArrayList(); Document pdfDoc = new Document(); pdfDoc.Author = xops.PDFDocumentAuthor; pdfDoc.Title = xops.PDFDocumentTitle; ceTe.DynamicPDF.Page tempPage; int j; foreach (ArrayList al in Pages) // Iterate through the collection of pages, each iteration contains the objects for the pages { tempPage = new ceTe.DynamicPDF.Page(); if (xops.PDFUsingTemplate) // If true, assign the template to the page, but not yet implmented { } foreach (ArrayList obj in al) // This iterates through the objects, each iteration will handle an object on the page { switch ((ExportOps.PDFObjectType)obj[0]) // Tells us which type of object we have and the structure of the arraylist { case ExportOps.PDFObjectType.Image: Image tempImage = new Image(MapPath(obj[1].ToString()), (float)obj[2], (float)obj[3], (float)obj[4]); tempPage.Elements.Add(tempImage); break; case ExportOps.PDFObjectType.BackgroundImage: BackgroundImage tempBackImage = new BackgroundImage(MapPath(obj[1].ToString())); tempBackImage.UseMargins = Convert.ToBoolean(obj[2]); tempPage.Elements.Add(tempBackImage); break; case ExportOps.PDFObjectType.Label: tempPage.Elements.Add(new Label(obj[1].ToString(), (float)obj[2], (float)obj[3], (float)obj[4], (float)obj[5], (Font)obj[6], (float)obj[7], (TextAlign)obj[8], (RgbColor)obj[9])); break; case ExportOps.PDFObjectType.Line: break; case ExportOps.PDFObjectType.Rectangle: break; case ExportOps.PDFObjectType.Link: break; case ExportOps.PDFObjectType.FormattedTextArea: FormattedTextAreaStyle style = new FormattedTextAreaStyle((FontFamily)obj[6], (float)obj[7], Convert.ToBoolean(obj[8])); FormattedTextArea textArea = new FormattedTextArea(Convert.ToString(obj[1]), (float)obj[2], (float)obj[3], (float)obj[4], (float)obj[5], style); tempPage.Elements.Add(textArea); // Check for over flow text if (textArea.GetOverflowFormattedTextArea() != null) { // Set up extra variables ceTe.DynamicPDF.Page overFlowPage; // There is more text than can be displayed, create a new page do { overFlowPage = new ceTe.DynamicPDF.Page(); textArea = textArea.GetOverflowFormattedTextArea(); // Add the text element overFlowPage.Elements.Add(textArea); // Add the page to the overflow array OverFlowPages.Add(overFlowPage); } while (textArea.GetOverflowFormattedTextArea() != null); } break; case ExportOps.PDFObjectType.OrderedList: break; case ExportOps.PDFObjectType.UnorderedList: break; case ExportOps.PDFObjectType.Table: break; case ExportOps.PDFObjectType.PageNumbering: break; default: // do nothing break; } } pdfDoc.Pages.Add(tempPage); if (OverFlowPages.Count > 0) { foreach (ceTe.DynamicPDF.Page p in OverFlowPages) { pdfDoc.Pages.Add(p); } // Clear the array OverFlowPages.Clear(); } } #region Old Code //for (int i = 0; i < Pages.Count; i++) //{ // tempPage = new ceTe.DynamicPDF.Page(); // // Insert the Header // if (Headers[i] != null) // { // headerTemp = (ArrayList)Headers[i]; // tempImage = new Image(MapPath(headerTemp[0].ToString()), (float)headerTemp[1], (float)headerTemp[2], (float) headerTemp[3]); // tempPage.Elements.Add(tempImage); // } // tempText = (ArrayList)Pages[i]; // foreach (ArrayList al in tempText) // { // tempString = al[0].ToString(); // tempPage.Elements.Add(new Label(al[0].ToString(), (float)al[1], (float)al[2], (float)al[3], (float)al[4], Font.TimesRoman, 12)); // } // foreach (ArrayList al in Pictures) // { // j = i + 1; // if (Convert.ToInt32(al[4]) == j) // { // tempImage = new Image(MapPath(al[0].ToString()), (float)al[1], (float)al[2], (float)al[3]); // tempPage.Elements.Add(tempImage); // } // } // pdfDoc.Pages.Add(tempPage); //} #endregion pdfDoc.DrawToWeb(this); }