Exemplo n.º 1
0
        public static void Run(string outputPdfPath)
        {
            // Create the document's layout from a DLEX template
            DocumentLayout documentLayout = new DocumentLayout(Util.GetResourcePath("DLEX/Invoice.dlex"));

            InvoiceExampleData.Order order      = InvoiceExampleData.Order11077;
            NameValueLayoutData      layoutData = new NameValueLayoutData();

            layoutData.Add("OrderID", order.OrderID);
            layoutData.Add("OrderDate", order.OrderDate);
            layoutData.Add("CustomerID", order.CustomerID);
            layoutData.Add("ShippedDate", order.ShippedDate);
            layoutData.Add("ShipperName", order.ShipperName);
            layoutData.Add("BillTo", order.BillTo);
            layoutData.Add("ShipTo", order.ShipTo);
            layoutData.Add("Freight", order.Freight);
            layoutData.Add("OrderDetails", order.OrderDetails);

            // Layout the document using the parameters and set it's properties
            Document document = documentLayout.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "Invoice Example";

            // Outputs the document to a file
            document.Draw(outputPdfPath);
        }
        public static void Run()
        {
            var jsonData = JsonConvert.DeserializeObject(File.ReadAllText(Util.GetPath("Resources/Data/SimpleReportData.json")));

            DocumentLayout layoutReport = new DocumentLayout(Util.GetPath("Resources/DLEXs/SimpleReportWithCoverPageFromJSON.dlex"));

            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("ReportCreatedFor", "Alex Smith");
            layoutData.Add("Products", jsonData);

            Document document = layoutReport.Layout(layoutData);

            document.Draw(Util.GetPath("Output/SimpleReportWithCoverPageFromJSON.pdf"));
        }
Exemplo n.º 3
0
        public static void Run(string outputPdfPath)
        {
            // Create the document's layout from a DLEX template
            DocumentLayout layoutReport = new DocumentLayout(Util.GetResourcePath("DLEX/FormFill.dlex"));

            // Specify the data.
            NameValueLayoutData layoutData = new NameValueLayoutData();
            W4Data w4Data = new W4Data
            {
                FirstNameAndI = "Alex B.",
                LastName      = "Smith",
                SSN           = "123-45-6789",
                HomeAddress   = "456 Green Road",
                IsSingle      = true,
                CityStateZip  = "Somewhere, Earth  12345",
                Allowances    = 2
            };

            layoutData.Add("W4Data", w4Data);

            // Layout the document and save the PDF
            Document document = layoutReport.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "Form Fill Example";

            document.Draw(outputPdfPath);
        }
        // Generates a PDF report using a collection of objects.
        // The collection of objects is in the SimpleReportWithCoverPageExampleData class.
        // This code uses the DynamicPDF ReportWriter for .NET product.
        // Use the ceTe.DynamicPDF namespace for the Document class.
        // Use the ceTe.DynamicPDF.LayoutEngine namespace for the DocumentLayout class.
        static void Main(string[] args)
        {
            // Create DocumentLayout object using the DLEX (report layout) file
            DocumentLayout layoutReport = new DocumentLayout(GetResourcePath("SimpleReportWithCoverPage.dlex"));

            // Create a NameValueLayoutData object with the Data
            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("ReportCreatedFor", "Alex Smith");
            layoutData.Add("Products", SimpleReportWithCoverPageExampleData.Products);

            // Get the Document from the DocumentLayout
            Document document = layoutReport.Layout(layoutData);

            //Save the Document
            document.Draw("output.pdf");
        }
Exemplo n.º 5
0
        public static void Run(string outputPdfPath)
        {
            DocumentLayout layoutReport = new DocumentLayout(Util.GetResourcePath("DLEX/SimpleReportWithCoverPage.dlex"));

            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("ReportCreatedFor", "Alex Smith");
            layoutData.Add("Products", SimpleReportWithCoverPageExampleData.Products);

            // Layout the document and set it's properties
            Document document = layoutReport.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "Simple Report Example";

            // Outputs the document to a file
            document.Draw(outputPdfPath);
        }
        public static void Run(string outputPdfPath)
        {
            // Create the document's layout from a DLEX template
            DocumentLayout layoutReport = new DocumentLayout(Util.GetResourcePath("DLEX/FormLetter.dlex"));

            // Specify the data.
            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("Name", "Alex Smith");
            layoutData.Add("Address", "456 Green Road\nSomewhere, Earth");
            layoutData.Add("Amount", "$321.00");

            // Layout the document and save the PDF
            Document document = layoutReport.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "Form Letter Example";

            document.Draw(outputPdfPath);
        }
Exemplo n.º 7
0
        public static void Run(string outputPdfPath)
        {
            //Create the document's layout from a DLEX template
            DocumentLayout documentLayout = new DocumentLayout(Util.GetResourcePath("DLEX/PlaceHolder.dlex"));

            // Retrieve the placeholder for the dynamic image and attach an event to it
            ceTe.DynamicPDF.LayoutEngine.LayoutElements.PlaceHolder barcode = (ceTe.DynamicPDF.LayoutEngine.LayoutElements.PlaceHolder)documentLayout.GetLayoutElementById("Barcode");
            barcode.LaidOut += Barcode_LaidOut;

            // Specify the Data to use when laying out the document
            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("HeaderData", "Popular Websites");
            layoutData.Add("Websites", PlaceHolderExampleData.Websites);

            // Layout the PDF document
            Document document = documentLayout.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "PlaceHolder Example";

            // Outputs the document to a file
            document.Draw(outputPdfPath);
        }
Exemplo n.º 8
0
        internal static void Run(string outputFilePath)
        {
            // Create the document's layout from a DLEX template
            DocumentLayout documentLayout = new DocumentLayout(Util.GetResourcePath("ReportWithSubReport.dlex"));

            // Attach to the ReportDataRequired event
            documentLayout.ReportDataRequired += DocumentLayout_ReportDataRequired;

            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("ReportCreatedFor", "Alex Smith");

            // Layout the document and save the PDF
            Document document = documentLayout.Layout(layoutData);

            document.Draw(outputFilePath);
        }
Exemplo n.º 9
0
        public static void Run(string outputPdfPath)
        {
            // Create the document's layout from a DLEX template
            DocumentLayout documentLayout = new DocumentLayout(Util.GetResourcePath("DLEX/ContactListWithGroupBy.dlex"));

            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("Contacts", ContactListWithGroupByExampleData.Contacts);

            // Layout the document using the parameters and set it's properties
            Document document = documentLayout.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "Contact List With Group By Example";

            // Outputs the document to a file
            document.Draw(outputPdfPath);
        }
        public static void Run(string outputPdfPath)
        {
            // Create the document's layout from a DLEX template
            DocumentLayout layoutReport = new DocumentLayout(Util.GetResourcePath("DLEX/SimpleSubReport.dlex"));

            NameValueLayoutData layoutData = new NameValueLayoutData();

            layoutData.Add("ProductsByCategory", SimpleSubReportExampleData.ProductsByCategory);

            // Layout the document and set it's properties
            Document document = layoutReport.Layout(layoutData);

            document.Author = "DynamicPDF ReportWriter";
            document.Title  = "Simple SubReport Example";

            // Outputs the document to a file
            document.Draw(outputPdfPath);
        }