Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }