Exemplo n.º 1
0
        public void SetCustomPaperSize(double width, double height, Unit unit)
        {
            PaperSize size = new PaperSize("custom_barcode_827x1169mm");

            size.SetSize(width, height, unit);

            DefaultPageSetup.PaperSize = size;
            if (PrintSettings != null)
            {
                PrintSettings.PaperSize = size;
            }
        }
Exemplo n.º 2
0
        public Report(string reportName, string svgFile)
        {
            // Load svg file
            this.svgDocument = new SvgDocument(svgFile);

            // Create PrintOperation object
            this.printOperation = new PrintOperation();
            this.printOperation.NPages = 1;
            this.printOperation.Unit = Unit.Mm;
            this.printOperation.JobName = reportName;
            this.printOperation.ExportFilename = "test.pdf";

            PrintSettings psettings = new PrintSettings();
            PaperSize paperSize = new PaperSize("customPaperSize", "cps",
                                                this.svgDocument.PageWidth,
                                                this.svgDocument.PageHeight,
                                                Unit.Mm);
            psettings.PaperSize = paperSize;

            Console.WriteLine("PageHeight: " + this.svgDocument.PageHeight.ToString());
            Console.WriteLine("PageWidth: " + this.svgDocument.PageWidth.ToString());
            Console.WriteLine();
            this.printOperation.PrintSettings = psettings;

            printOperation.DrawPage += this.DrawPage;
            printOperation.BeginPrint += this.BeginPrint;

            // Set default action
            this.action = PrintOperationAction.Export;

            // Data
            this.data = new Dictionary<string, string>();
            this.dataTables = new Dictionary<string, DataTable>();

            this.pageHeader = this.svgDocument.PageHeaderSection;
            this.pageDetail = this.svgDocument.PageDetailSection;
            this.pageFooter = this.svgDocument.PageFooterSection;
        }