Ejemplo n.º 1
0
        public void GenerateInvoice()
        {
            var shipping = GenerateShipping();

            FacturaModel fact = new FacturaModel();

            fact.NIT         = "900.656.261.6";
            fact.RazonSocial = "TCC S.A.S";
            fact.Model       = shipping;


            List <FacturaModel> ord = new List <FacturaModel>();

            ord.Add(fact);
            Factura          xtrareport = new Factura();
            PdfExportOptions opts       = new PdfExportOptions();

            try
            {
                xtrareport.DataSource = ord;
                string path = @"C:\Kiosko\temp\test.pdf";
                xtrareport.ExportToPdf(path);
                xtrareport.CreateDocument(false);
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 2
0
        public TradelaneFile ShipmentManifest(int tradelaneShipmentId, int userId)
        {
            TradelaneFile result = new TradelaneFile();
            List <TradelaneManifestReport> model = new TradelaneReportsRepository().ManifestReportModel(tradelaneShipmentId, userId);

            ReportTemplate.Tradelane.Manifest report = new ReportTemplate.Tradelane.Manifest();
            report.DataSource = model;

            PdfExportOptions options = new PdfExportOptions();

            options.ImageQuality      = PdfJpegImageQuality.Highest;
            options.PdfACompatibility = PdfACompatibility.None;

            string fileName         = "Summary_Manifest_" + (!string.IsNullOrEmpty(model[0].MAWB) ? model[0].AirlineCode + "-" + model[0].MAWB : model[0].FrayteNumber) + ".pdf";
            string filePath         = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName;
            string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName);

            if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")))
            {
                System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"));
            }

            if (File.Exists(filePhysicalPath))
            {
                File.Delete(filePhysicalPath);
            }

            report.ExportToPdf(filePhysicalPath, options);

            result.FileName            = fileName;
            result.FilePath            = filePath;
            result.TradelaneShipmentId = tradelaneShipmentId;
            return(result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string          reportDataHandle = Request.QueryString["reportContainerHandle"];
            ReportsModuleV2 module           = ReportsModuleV2.FindReportsModule(ApplicationReportObjectSpaceProvider.ContextApplication.Modules);

            if (!String.IsNullOrEmpty(reportDataHandle) && module != null)
            {
                XtraReport report = null;
                try {
                    report = ReportDataProvider.ReportsStorage.GetReportContainerByHandle(reportDataHandle).Report;
                    module.ReportsDataSourceHelper.SetupBeforePrint(report, null, null, false, null, false);
                    using (MemoryStream ms = new MemoryStream()) {
                        report.CreateDocument();
                        PdfExportOptions options = new PdfExportOptions();
                        options.ShowPrintDialogOnOpen = true;
                        report.ExportToPdf(ms, options);
                        ms.Seek(0, SeekOrigin.Begin);
                        byte[] reportContent = ms.ToArray();
                        Response.ContentType = "application/pdf";
                        Response.AddHeader("Content-Disposition", "attachment; filename=MyFileName.pdf");
                        Response.Clear();
                        Response.OutputStream.Write(reportContent, 0, reportContent.Length);
                        Response.End();
                    }
                }
                finally {
                    if (report != null)
                    {
                        report.Dispose();
                    }
                }
            }
        }
        private void SetReportPreview(bool preview, XtraReport report, bool createDocument = true)
        {
            if (createDocument)
            {
                report.CreateDocument();
            }

            //report.ExportToPdf("");//Shranjevanje poročila na disk

            if (preview)
            {
                WebDocumentViewer.OpenReport(report);
            }
            else
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    PdfExportOptions opts = new PdfExportOptions();
                    opts.ShowPrintDialogOnOpen = true;
                    report.ExportToPdf(ms, opts);

                    WriteDocumentToResponse(ms.ToArray(), "pdf", true, "Report_" + DateTime.Now.ToString("dd_MM_YYYY-HH_mm_ss_") + DateTime.Now.TimeOfDay.TotalMilliseconds.ToString());
                }
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string ID = Request.QueryString["ID"];

            //rpHoaDonBanHang rp = new rpHoaDonBanHang();
            //rp.Parameters["ID"].Value = ID;
            //rp.Parameters["ID"].Visible = false;
            //viewerReport.Report = rp;

            using (MemoryStream ms = new MemoryStream())
            {
                rpHoaDonBanHang r = new rpHoaDonBanHang();
                r.Parameters["ID"].Value = ID;
                r.CreateDocument();
                PdfExportOptions opts = new PdfExportOptions();
                opts.ShowPrintDialogOnOpen = true;
                r.ExportToPdf(ms, opts);
                ms.Seek(0, SeekOrigin.Begin);
                byte[] report = ms.ToArray();
                Page.Response.ContentType = "application/pdf";
                Page.Response.Clear();
                Page.Response.OutputStream.Write(report, 0, report.Length);
                Page.Response.End();
            }
        }
Ejemplo n.º 6
0
        private string alsPDFspeichern(string reportPath)
        {
            //string reportPath = getThePath();


            PdfExportOptions pdfOptions = r1.ExportOptions.Pdf;

            // Specify the pages to be exported.
            //     pdfOptions.PageRange = "1, 3-5";

            // Specify the document options.
            pdfOptions.DocumentOptions.Application = "PriPro";
            pdfOptions.DocumentOptions.Author      = "Automatisch erstellt";
            pdfOptions.DocumentOptions.Keywords    = "PriPro, Reporting, PDF";
            pdfOptions.DocumentOptions.Producer    = Environment.UserName.ToString();
            pdfOptions.DocumentOptions.Subject     = "Lieferung";
            pdfOptions.DocumentOptions.Title       = "Lieferschein";


            try
            {
                r1.ExportToPdf(reportPath, pdfOptions);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler beim erstellen der PDF" + Environment.NewLine + Environment.NewLine + ex.ToString());
            }


            return(reportPath);
        }
        public HttpResponseMessage ExportToPdf(string reportId, string accessId, string parameters = null, string entityId = null)
        {
            var report = GetXtraReport(reportId, parameters, entityId, accessId);

            PdfExportOptions exportOptions = report.ExportOptions.Pdf;

            exportOptions.ConvertImagesToJpeg   = true;
            exportOptions.ImageQuality          = PdfJpegImageQuality.Medium;
            exportOptions.ShowPrintDialogOnOpen = false;

            var memoryStream = new MemoryStream();

            report.ExportToPdf(memoryStream);
            memoryStream.Position = 0;

            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);

            response.Content = new ByteArrayContent(memoryStream.ToArray());
            response.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/pdf");
            response.Content.Headers.ContentLength      = memoryStream.Length;
            response.Content.Headers.ContentDisposition =
                new ContentDispositionHeaderValue("inline")
            {
                FileName = $"{report.PrintingSystem.ExportOptions.PrintPreview.DefaultFileName}.pdf",
            };

            return(response);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            var report = new XtraReport1();

            report.XmlDataPath = "ZUGFeRD-invoice.xml";

            string additionalMetadata =
                File.ReadAllText("ZUGFeRD_DocumentInfo.txt") +
                File.ReadAllText("ZUGFeRD_PdfASchema.txt");

            PdfExportOptions options = new PdfExportOptions()
            {
                PdfACompatibility  = PdfACompatibility.PdfA3b,
                AdditionalMetadata = additionalMetadata
            };

            options.Attachments.Add(new PdfAttachment()
            {
                FilePath    = "ZUGFeRD-invoice.xml",
                Type        = "text/xml",
                Description = "Rechnungsdaten im ZUGFeRD-XML-Format",
            });

            report.ExportToPdf("result.pdf", options);
            Process.Start("result.pdf");
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Rpt_TicketPago report = new Rpt_TicketPago();
            string         path   = HttpContext.Current.Server.MapPath(@"~\Reportes\Rpt_TicketPago.repx");

            //report.LoadLayout(path);
            report.Parameters["IdPago"].Value = "1934";
            report.PrintingSystem.ExportOptions.Pdf.ShowPrintDialogOnOpen = true;
            //report.PrinterName = "HP Color LaserJet Pro MFP M477 PCL-6";
            //report.CreateDocument();
            //report.PrintingSystem.ShowMarginsWarning = false;



            //report.CreateDocument();
            //ASPxWebDocumentViewer1.OpenReport(report);
            using (MemoryStream ms = new MemoryStream())
            {
                report.CreateDocument();
                PdfExportOptions options = new PdfExportOptions();
                options.ShowPrintDialogOnOpen = true;
                report.ExportToPdf(ms, options);
                // WriteDocumentToResponse(ms.ToArray(), "pdf", false, "Report.pdf");
                //return;
                ms.Seek(0, SeekOrigin.Begin);
                byte[] reportContent = ms.ToArray();
                Response.ContentType = "application/pdf";
                Response.Clear();
                Response.OutputStream.Write(reportContent, 0, reportContent.Length);
                Response.End();
            }
        }
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (this.dcmvReport.DocumentSource != null)
            {
                string       fileName = "";
                DialogResult result   = this.folderBrowserDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    fileName = this.folderBrowserDialog.SelectedPath;


                    PdfExportOptions pdfOption = this._templateReport.ExportOptions.Pdf;
                    pdfOption.Compressed                  = true;
                    pdfOption.ImageQuality                = PdfJpegImageQuality.Medium;
                    pdfOption.NeverEmbeddedFonts          = "Tahoma;Courier New";
                    pdfOption.DocumentOptions.Application = "QuanLiBanVang";
                    pdfOption.DocumentOptions.Author      = ExtendClass.UserAccess.Instance.GetStaffName;
                    pdfOption.DocumentOptions.Keywords    = "Xtra Report";
                    pdfOption.DocumentOptions.Subject     = "Bao cao cong no";
                    pdfOption.DocumentOptions.Title       = "Báo cáo công nợ";
                    fileName += "\\" + pdfOption.DocumentOptions.Title + ".pdf";
                    //pdfOption.PageRange = "1";
                    _templateReport.ExportToPdf(fileName);
                    MessageBox.Show("Xuất file thành công!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.StartProcess(fileName);
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Von dem Doc-Dokument wird die erste Seite in tiff konvertiert und gespeichert.
        /// die funktion liefert den Path zu der neue Datei zurück.
        /// </summary>
        public string GetFirstPageAsImageFromDocument(DocumentParam param)
        {
            try
            {
                string   fileName = string.Empty;
                FileInfo fileInfo = new FileInfo(param.FilePath);

                if (fileInfo.Exists == false)
                {
                    return(fileName);
                }

                string pathFolder = Path.GetTempPath();

                FilesFunctions.DeleteFilesInFolder(pathFolder, Tiff);
                string tempName = FilesFunctions.GetRandomName(pathFolder, fileInfo, true, Pdf);
                using (RichEditDocumentServer richServer = new RichEditDocumentServer())
                {
                    richServer.LoadDocument(param.FilePath);

                    //Specify export options:
                    PdfExportOptions options = new PdfExportOptions
                    {
                        Compressed   = false,
                        ImageQuality = PdfJpegImageQuality.Highest
                    };
                    //Export the document to the stream:

                    using (FileStream pdfFileStream = new FileStream(tempName, FileMode.Create))
                    {
                        richServer.ExportToPdf(pdfFileStream, options);
                    }
                }

                var pdf = new PdfTiffConverter();

                var parammeter = new DocumentParam
                {
                    Resolution   = param.Resolution,
                    Colour       = param.Colour,
                    Compression  = param.Compression,
                    Quality      = param.Quality,
                    KeepOriginal = param.KeepOriginal,
                    ConTyp       = param.ConTyp,
                    Doctyp       = param.Doctyp,
                    FilePath     = tempName
                };

                fileName = pdf.GetFirstPageAsImageFromDocument(parammeter);


                return(fileName);
            }
            catch (Exception ex)
            {
                FileLogger.FileLogger.Instance.WriteExeption(ex);
                return(string.Empty);
            }
        }
        // export the grid to a PDF file
        void SavePdf(Stream s, string documentName)
        {
            PdfExportOptions options = new PdfExportOptions();

            options.Margin    = new Thickness(96, 96, 96 / 2, 96 / 2);
            options.ScaleMode = ScaleMode.ActualSize;
            _flex.SavePdf(s, options);
            s.Close();
        }
        public void ConvertWithOptionsFromRequest()
        {
            Stream        file      = File.OpenRead(Path.Combine(TestUtils.TestDataPath, c_fileName));
            Stream        converted = TestUtils.SlidesApi.Convert(file, c_format, password: c_password);
            ExportOptions options   = new PdfExportOptions {
                DrawSlidesFrame = true
            };
            Stream convertedWithOptions = TestUtils.SlidesApi.Convert(file, c_format, c_password, options: options);

            Assert.AreNotEqual(converted.Length, convertedWithOptions.Length);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // A path to export a report.
            string reportPath = @"c:\\Temp\Test.pdf";

            using (XtraReport1 report = new XtraReport1()) {
                // Specify PDF-specific export options.
                PdfExportOptions pdfOptions = report.ExportOptions.Pdf;

                // Specify the pages to be exported.
                pdfOptions.PageRange = "1, 3-5";

                // Specify the quality of exported images.
                pdfOptions.ConvertImagesToJpeg = false;
                pdfOptions.ImageQuality        = PdfJpegImageQuality.Medium;

                // Specify the PDF/A-compatibility.
                pdfOptions.PdfACompatibility = PdfACompatibility.PdfA3b;

                // The following options are not compatible with PDF/A.
                // The use of these options will result in errors on PDF validation.
                //pdfOptions.NeverEmbeddedFonts = "Tahoma;Courier New";
                //pdfOptions.ShowPrintDialogOnOpen = true;

                // If required, you can specify the security and signature options.
                //pdfOptions.PasswordSecurityOptions
                //pdfOptions.SignatureOptions

                // If required, specify necessary metadata and attachments
                // (e.g., to produce a ZUGFeRD-compatible PDF).
                //pdfOptions.AdditionalMetadata
                //pdfOptions.Attachments

                // Specify the document options.
                pdfOptions.DocumentOptions.Application = "Test Application";
                pdfOptions.DocumentOptions.Author      = "DX Documentation Team";
                pdfOptions.DocumentOptions.Keywords    = "DevExpress, Reporting, PDF";
                pdfOptions.DocumentOptions.Producer    = Environment.UserName.ToString();
                pdfOptions.DocumentOptions.Subject     = "Document Subject";
                pdfOptions.DocumentOptions.Title       = "Document Title";

                // Checks the validity of PDF export options
                // and return a list of any detected inconsistencies.
                IList <string> result = pdfOptions.Validate();
                if (result.Count > 0)
                {
                    Console.WriteLine(String.Join(Environment.NewLine, result));
                }
                else
                {
                    report.ExportToPdf(reportPath, pdfOptions);
                }
            }
        }
Ejemplo n.º 15
0
        public TradelaneFile ShipmentCoLoadForm(int tradelaneShipmentId)
        {
            TradelaneFile    result         = new TradelaneFile();
            TradelaneBooking ShipmentDetail = new TradelaneBookingRepository().GetTradelaneBookingDetails(tradelaneShipmentId, "");
            List <TradelaneBookingCoLoadFormModel> ColoadModel = new TradelaneReportsRepository().ColoadReportObj(ShipmentDetail);

            ReportTemplate.Tradelane.CoLoadBookingForm report = new ReportTemplate.Tradelane.CoLoadBookingForm();
            if (ColoadModel[0].OperationZoneId == 1)
            {
                report.Parameters["lblWebSite"].Value  = "WWW.FRAYTE.COM";
                report.Parameters["lblCompany"].Value  = "FRAYTE LOGISTICS LTD";
                report.Parameters["lblAddress1"].Value = "UNIT 2306, 23/F, Trendy Center";
                report.Parameters["lblAddress2"].Value = "682-684 Castle Peak Road";
                report.Parameters["lblAddress3"].Value = "CHEUNG SHA WAN, HONG KONG";
            }
            else
            {
                report.Parameters["lblWebSite"].Value  = "WWW.FRAYTE.CO.UK";
                report.Parameters["lblCompany"].Value  = "FRAYTE LOGISTICS LTD";
                report.Parameters["lblAddress1"].Value = "UNIT 2306, 23/F, Trendy Center";
                report.Parameters["lblAddress2"].Value = "682-684 Castle Peak Road";
                report.Parameters["lblAddress3"].Value = "CHEUNG SHA WAN, HONG KONG";
            }
            report.DataSource = ColoadModel;

            PdfExportOptions options = new PdfExportOptions();

            options.ImageQuality      = PdfJpegImageQuality.Highest;
            options.PdfACompatibility = PdfACompatibility.None;

            string fileName         = "Co_Load_Booking_Form_for_" + (!string.IsNullOrEmpty(ColoadModel[0].MawbNo) ? ColoadModel[0].DestinationAirport + "_" + ColoadModel[0].MawbNo : ColoadModel[0].FrayteNumber) + ".pdf";
            string filePath         = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName;
            string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/");

            filePhysicalPath += fileName;

            if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")))
            {
                System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"));
            }


            if (File.Exists(filePhysicalPath))
            {
                File.Delete(filePhysicalPath);
            }

            report.ExportToPdf(filePhysicalPath, options);

            result.FileName = fileName;
            result.FilePath = filePath;
            return(result);
        }
Ejemplo n.º 16
0
        private void CrearPDF(string fileNamepdf)
        {
            int folio = Convert.ToInt32(txtFolio.Text);
            rpt_InventarioCiego_Enviado rpt = new rpt_InventarioCiego_Enviado(folio);

            ((SqlDataSource)rpt.DataSource).ConfigureDataConnection += Form1_ConfigureDataConnection;
            ReportPrintTool  print      = new ReportPrintTool(rpt);
            PdfExportOptions pdfOptions = rpt.ExportOptions.Pdf;

            pdfOptions.PageRange = "1-1000";

            // Specify the quality of exported images.
            pdfOptions.ConvertImagesToJpeg = false;
            pdfOptions.ImageQuality        = PdfJpegImageQuality.Medium;

            // Specify the PDF/A-compatibility.
            pdfOptions.PdfACompatibility = PdfACompatibility.PdfA3b;

            // The following options are not compatible with PDF/A.
            // The use of these options will result in errors on PDF validation.
            //pdfOptions.NeverEmbeddedFonts = "Tahoma;Courier New";
            //pdfOptions.ShowPrintDialogOnOpen = true;

            // If required, you can specify the security and signature options.
            //pdfOptions.PasswordSecurityOptions
            //pdfOptions.SignatureOptions

            // If required, specify necessary metadata and attachments
            // (e.g., to produce a ZUGFeRD-compatible PDF).
            //pdfOptions.AdditionalMetadata
            //pdfOptions.Attachments

            // Specify the document options.
            pdfOptions.DocumentOptions.Application = "Reporte Inventario Ciego";
            pdfOptions.DocumentOptions.Author      = "NexusSoft";
            pdfOptions.DocumentOptions.Keywords    = "SES_Inventarios, Reporte, PDF";
            pdfOptions.DocumentOptions.Producer    = Environment.UserName.ToString();
            pdfOptions.DocumentOptions.Subject     = "Documento Inventario";
            pdfOptions.DocumentOptions.Title       = "Reporte Inventario Ciego";

            // Checks the validity of PDF export options
            // and return a list of any detected inconsistencies.
            IList <string> result = pdfOptions.Validate();

            if (result.Count > 0)
            {
                Console.WriteLine(String.Join(Environment.NewLine, result));
            }
            else
            {
                rpt.ExportToPdf(fileNamepdf, pdfOptions);
            }
        }
Ejemplo n.º 17
0
        protected virtual void SaveSpreadsheetToFile(IWorkbook workbook, string fileName)
        {
            var format = DocumentFormat.Xlsx;

            switch (Path.GetExtension(fileName)?.ToLower())
            {
            case ".xlsx":
                format = DocumentFormat.Xlsx;
                break;

            case ".xls":
                format = DocumentFormat.Xls;
                break;

            case ".csv":
                format = DocumentFormat.Csv;
                break;

            case ".txt":
            case ".text":
                format = DocumentFormat.Text;
                break;

            case ".pdf":
                format = DocumentFormat.Undefined;
                break;
            }

            if (format == DocumentFormat.Undefined)
            {
                var pdfOptions = new PdfExportOptions()
                {
                    ConvertImagesToJpeg   = false,
                    ImageQuality          = PdfJpegImageQuality.Highest,
                    PdfACompatibility     = PdfACompatibility.None,
                    ShowPrintDialogOnOpen = false
                };

                using var ps   = new PrintingSystem();
                using var link = new PrintableComponentLink(ps)
                      {
                          Component = workbook
                      };
                link.CreateDocument();

                ExecuteLocked(() => ps.ExportToPdf(fileName, pdfOptions), LockFiles ? LockObject : null);
            }
            else
            {
                ExecuteLocked(() => workbook.SaveDocument(fileName, format), LockFiles ? LockObject : null);
            }
        }
        public void ConvertSlideWithOptionsFromStorage()
        {
            TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName);
            Stream converted = TestUtils.SlidesApi.DownloadSlide(
                c_fileName, c_slideIndex, c_slideFormat, password: c_password, folder: c_folderName);
            ExportOptions options = new PdfExportOptions {
                DrawSlidesFrame = true
            };
            Stream convertedWithOptions = TestUtils.SlidesApi.DownloadSlide(
                c_fileName, c_slideIndex, c_slideFormat, options, password: c_password, folder: c_folderName);

            Assert.AreNotEqual(converted.Length, convertedWithOptions.Length);
        }
        public void SplitWithOptions()
        {
            TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName);
            ExportOptions options = new PdfExportOptions {
                JpegQuality = 50
            };
            SplitDocumentResult result = TestUtils.SlidesApi.Split(
                c_fileName, options, SlideExportFormat.Pdf, password: c_password, folder: c_folderName);

            string url  = result.Slides[0].Href;
            string path = url.Substring(url.IndexOf("/storage/file/") + "/storage/file/".Length);

            Assert.IsTrue(TestUtils.SlidesApi.ObjectExists(path).Exists.Value);
        }
 static void ExportToPDF(RichEditDocumentServer server)
 {
     #region #ExportToPDF
     server.LoadDocument("Documents\\MovieRentals.docx", DocumentFormat.OpenXml);
     //Specify export options:
     PdfExportOptions options = new PdfExportOptions();
     options.DocumentOptions.Author = "Mark Jones";
     options.Compressed             = false;
     options.ImageQuality           = PdfJpegImageQuality.Highest;
     //Export the document to the stream:
     using (FileStream pdfFileStream = new FileStream("Document_PDF.pdf", FileMode.Create))
     {
         server.ExportToPdf(pdfFileStream, options);
     }
     System.Diagnostics.Process.Start("Document_PDF.pdf");
     #endregion #ExportToPDF
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         XtraReport1 r = new XtraReport1();
         r.CreateDocument();
         PdfExportOptions opts = new PdfExportOptions();
         opts.ShowPrintDialogOnOpen = true;
         r.ExportToPdf(ms, opts);
         ms.Seek(0, SeekOrigin.Begin);
         byte[] report = ms.ToArray();
         Page.Response.ContentType = "application/pdf";
         Page.Response.Clear();
         Page.Response.OutputStream.Write(report, 0, report.Length);
         Page.Response.End();
     }
 }
Ejemplo n.º 22
0
        public async Task <string> AllProducts(Cls_Product Cls_Product)
        {
            if (Session["UserID"] != null)
            {
                List <Cls_ProductSummary> Cls_ProductSummary =
                    await db.Products.Select(a =>
                                             new Cls_ProductSummary
                {
                    Product_Name    = a.Name,
                    Company_Name    = a.Company.Name,
                    Department_Name = a.Company.Department.Name,
                    Current_Amount  = 0,
                    Prev_Amount     = 0,
                    Sell_Amount     = 0
                }).ToListAsync();

                string _path      = System.Web.HttpContext.Current.Server.MapPath(@"~/Reports/pdf");
                Random random     = new Random();
                string tick       = DateTime.Now.Ticks.ToString();
                string reportPath = Path.Combine(_path, "Rpt_Products.pdf");

                Rpt_Products report = new Rpt_Products();
                report.DataSource = Cls_ProductSummary;

                PdfExportOptions pdfOptions = report.ExportOptions.Pdf;
                pdfOptions.Compressed                  = true;
                pdfOptions.ImageQuality                = PdfJpegImageQuality.Low;
                pdfOptions.NeverEmbeddedFonts          = "Tahoma;Courier New";
                pdfOptions.DocumentOptions.Application = "Human Resources Application";
                pdfOptions.DocumentOptions.Author      = "مؤسسة حوران الشامل لقنية الحاسب الآلي والإنترنت";
                pdfOptions.DocumentOptions.Subject     = "باركود الصنف";
                pdfOptions.DocumentOptions.Title       = "باركود الصنف";
                report.ExportToPdf(reportPath);

                return("/Reports/pdf/Rpt_Products.pdf");
            }
            else
            {
                Error.ErrorFullNumber = "AR-Logout-089";
                Error.ErrorNumber     = "089";
                Error.Url             = "URLReport";
                Error.ErrorName       = "تم تسجيل خروجك آلياً لانتهاء المدة المسموح بها";
                return("");
            }
        }
Ejemplo n.º 23
0
        public static bool GeneratePdfReport(XtraReport report, string fileName)
        {
            PdfExportOptions options = new PdfExportOptions();
            //options.PdfACompatibility = PdfACompatibility.PdfA1b;
            //options.PasswordSecurityOptions.PermissionsPassword = "******";
            //options.ShowPrintDialogOnOpen = true;
            IList <string> result = options.Validate();

            if (result.Count > 0)
            {
                //Console.WriteLine(String.Join(Environment.NewLine, result));
                return(false);
            }

            Directory.CreateDirectory("PDF");

            report.ExportToPdf($"PDF/{fileName}.pdf", options);
            return(true);
        }
Ejemplo n.º 24
0
        public void ConvertDocumentToPdf(string plik, string outputFile)
        {
            var server = new RichEditDocumentServer();

            server.LoadDocument(plik, DocumentFormat.OpenDocument);
            //Specify export options:
            PdfExportOptions options = new PdfExportOptions();

            options.DocumentOptions.Author = "Mediqus";
            options.Compressed             = false;
            options.ImageQuality           = PdfJpegImageQuality.Highest;
            //Export the document to the stream:


            using (FileStream pdfFileStream = new FileStream(outputFile, FileMode.Create))
            {
                server.ExportToPdf(pdfFileStream, options);
            }
        }
Ejemplo n.º 25
0
        public ActionResult Pdf()
        {
            // Criando o objeto XtraReport, que representa o relatório.
            DevExpress.XtraReports.UI.XtraReport report = new DevExpress.XtraReports.UI.XtraReport();

            // Arquivo repx que contém o layout do relatório.
            string reportPath = Server.MapPath("~/Reports/XtraReport.repx");

            // Criando um business object com os dados para o relatório.
            ArrayList listDataSource = new ArrayList();

            for (int i = 0; i < 200; i++)
            {
                var index = i + 1;

                listDataSource.Add(new ReportProduto
                {
                    ID        = index,
                    Descricao = $"Produto {index.ToString("D2")}",
                    Marca     = $"Marca {index.ToString("D2")}",
                    Foto      = $"Foto {index.ToString("D2")}"
                });
            }

            // Informando para o DataSource do relatório qual será os dados.
            report.DataSource = listDataSource;

            // Configurado o arquivo repx como arquivo de layout.
            report.LoadLayout(reportPath);

            // Informando onde será gerado o arquivo pdf.
            var pdfExportFile = Server.MapPath("~/Files/Pdf/XtraReport.pdf");

            // Configurando as opções de exportação do pdf.
            PdfExportOptions options = new PdfExportOptions();

            options.PdfACompatibility = PdfACompatibility.PdfA1b;

            // Exportando o arquivo pdf.
            report.ExportToPdf(pdfExportFile, options);

            return(View());
        }
        static void Main(string[] args)
        {
            using (TreeMapControl treeMap = new TreeMapControl(947, 660)) {
                treeMap.InnerTreeMap.DataAdapter = CreateDataAdapter();
                TreeMapGroupGradientColorizer colorizer = new TreeMapGroupGradientColorizer();
                colorizer.Palette = Palettes.GetPalette("Office");
                treeMap.InnerTreeMap.Colorizer = colorizer;

                if (!Directory.Exists(OutputPath))
                {
                    Directory.CreateDirectory(OutputPath);
                }

                treeMap.InnerTreeMap.Printer.ExportToImage(OutputPath + "/Test.png", ImageFormat.Png);
                PdfExportOptions options = new PdfExportOptions();
                options.ConvertImagesToJpeg = false;
                treeMap.InnerTreeMap.Printer.ExportToPdf(OutputPath + "/Test.pdf", options);
            }

            Console.WriteLine("Done.");
        }
Ejemplo n.º 27
0
        private void ExportButton_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            // Obtain the current export options.
            PdfExportOptions options = new PdfExportOptions();

            // Set Print Preview options.
            options.Compressed     = false;
            options.ImageQuality   = PdfJpegImageQuality.Highest;
            options.PdfACompatible = true;

            forceVitesseChart.OptionsPrint.SizeMode  = DevExpress.XtraCharts.Printing.PrintSizeMode.Stretch;
            forceVitesseMChart.OptionsPrint.SizeMode = DevExpress.XtraCharts.Printing.PrintSizeMode.Stretch;
            forcePositionChart.OptionsPrint.SizeMode = DevExpress.XtraCharts.Printing.PrintSizeMode.Stretch;

            PrintableComponentLink link1 = new PrintableComponentLink();
            PrintableComponentLink link2 = new PrintableComponentLink();
            PrintableComponentLink link3 = new PrintableComponentLink();
            var composentlink            = new DevExpress.XtraPrintingLinks.CompositeLink(new PrintingSystem());

            link1.Component = forcePositionChart;
            link2.Component = forceVitesseChart;
            link3.Component = forceVitesseMChart;
            composentlink.Links.Add(link1);
            composentlink.Links.Add(link2);
            composentlink.Links.Add(link3);
            composentlink.Landscape = true;

            //page permettant de choisir l'emplacement et le nom du fichier pour l'enregistrement
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                composentlink.ExportToPdf(saveFileDialog1.FileName + ".pdf", options);
                MessageBox.Show("Exportation réussie", "PDF");
            }

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 28
0
        internal string ExportReport()
        {
            Rpt_Invoice_Moshtary report = new Rpt_Invoice_Moshtary();
            string _path      = System.Web.HttpContext.Current.Server.MapPath(@"~/Reports/pdf");
            Random random     = new Random();
            string tick       = DateTime.Now.Ticks.ToString();
            string reportPath = Path.Combine(_path, "Rpt_Invoice_Cancel.pdf");


            PdfExportOptions pdfOptions = report.ExportOptions.Pdf;

            pdfOptions.Compressed                  = true;
            pdfOptions.ImageQuality                = PdfJpegImageQuality.Low;
            pdfOptions.NeverEmbeddedFonts          = "Tahoma;Courier New";
            pdfOptions.DocumentOptions.Application = "Human Resources Application";
            pdfOptions.DocumentOptions.Author      = "مؤسسة حوران الشامل لقنية الحاسب الآلي والإنترنت";
            pdfOptions.DocumentOptions.Subject     = "باركود الصنف";
            pdfOptions.DocumentOptions.Title       = "باركود الصنف";

            report.ExportToPdf(reportPath);
            return("Rpt_Invoice_Cancel");
        }
        static void Main(string[] args)
        {
            using (ChartContainer container = new ChartContainer()) {
                container.Size = new Size(500, 500);
                container.Chart.Titles.Add(new ChartTitle()
                {
                    Text = "Linux OpenGL test very very long title a b c aaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccc dddddddddddddddddddddddddddddd"
                });
                container.Chart.Titles[0].WordWrap  = true;
                container.Chart.Titles[0].Alignment = StringAlignment.Near;
                Random random = new Random(0);
                container.Chart.Legend.Visibility = DefaultBoolean.False;
                for (int i = 0; i < 1; i++)
                {
                    Series series = new Series("Series", ViewType.Pie);
                    series.Label.TextPattern = "{S} : {A} : {V} : {VP}";
                    PieSeriesView view = (PieSeriesView)series.View;
                    view.MinAllowedSizePercentage = 80;
                    for (int j = 0; j < 10; j++)
                    {
                        series.Points.Add(new SeriesPoint(j.ToString() + " Long Argument", random.Next(100)));
                    }
                    container.Chart.Series.Add(series);
                }

                if (!Directory.Exists(OutputPath))
                {
                    Directory.CreateDirectory(OutputPath);
                }

                container.Chart.ExportToImage(OutputPath + "/Test.png", ImageFormat.Png);
                PdfExportOptions options = new PdfExportOptions();
                options.ConvertImagesToJpeg = false;
                container.Chart.ExportToPdf(OutputPath + "/Test.pdf", options);

                Console.WriteLine("Done.");
            }
        }
        private void exportFilePdf(XtraReport report)
        {
            string           reportPath = "";
            PdfExportOptions pdfOptions = report.ExportOptions.Pdf;

            pdfOptions.ImageQuality                = PdfJpegImageQuality.Medium;
            pdfOptions.PdfACompatibility           = PdfACompatibility.PdfA3b;
            pdfOptions.DocumentOptions.Application = "Test Application";
            pdfOptions.DocumentOptions.Author      = "DX Documentation Team";
            pdfOptions.DocumentOptions.Keywords    = "DevExpress, Reporting, PDF";
            pdfOptions.DocumentOptions.Producer    = Environment.UserName.ToString();
            pdfOptions.DocumentOptions.Subject     = "Document Subject";
            pdfOptions.DocumentOptions.Title       = "Document Title";
            IList <string> result = pdfOptions.Validate();
            SaveFileDialog sf     = new SaveFileDialog();

            sf.FileName = "Save Here.pdf";
            if (sf.ShowDialog() == DialogResult.OK)
            {
                reportPath = Path.GetDirectoryName(sf.FileName) + sf.FileName;
                if (result.Count > 0)
                {
                    Console.WriteLine(String.Join(Environment.NewLine, result));
                }
                else
                {
                    try
                    {
                        report.ExportToPdf(sf.FileName);
                        MessageBox.Show("Lưu thành công!");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 31
0
 public void ExportToPdf(Stream stream, PdfExportOptions options)
 {
     report.ExportToPdf(stream, options);
 }