Export to pdf

Posted by: r.trofymchuk on 9 February 2023, 10:13 pm EST

  • Posted 9 February 2023, 10:13 pm EST - Updated 10 February 2023, 1:42 am EST

    Hi guys,

    I want to save the generated report to pdf.

    How do I subscribe to the event (LongOperation) that happens in C1PrintDocument.Export, because the window that is shown when exporting I would like to replace with my own.

    How to change the language in the code for the “Save as pdf” form.

    I have a German version of Windows, but I want to call this window programmatically in the English version.

    It is possible at all without changing the language in Windows?

  • Posted 13 February 2023, 12:25 am EST

    Hi,

    We didn’t see any Window while exporting Pdf by C1PrintPdfDocument. Please refer the attached sample for the same: PrintDocument.zip

    Could you please provide some more details for which window you are have asked to replace with new one?

    Regards,

    Nitin

  • Posted 13 February 2023, 1:42 am EST

    Hi,

    Okay, let’s start with a simple one.

    In your example, change the method call to doc1.Export(“TextAreaTest1.pdf”,true);

    During the export the window with Progressbar will be shown, is it possible to change the language of this window, so that the window will be displayed for example in German for a user with an English version of Windows installed?

  • Posted 13 February 2023, 6:11 pm EST

    Hi,

    Passing true in the Export method will show a Progress Window and you can change the language before and after exporting accordingly.

            private void ExportData(C1PrintDocument doc1)
            {
                //Change to German
                Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
                doc1.Export("TextAreaTest1.pdf", true);
                //Change to English after export
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            }

    Please refer the attached sample for the same: PrintDocument_Mod.zip

    Best Regards,

    Nitin

  • Posted 15 February 2023, 7:38 pm EST

    Hi, thanks for your support!

    What other languages do you support besides German and English?

    It is possible to configure settings for a PDF file when exporting. Is it possible to set these settings programmatically (e.g. disable “Use compression”) using my export example, or manage all these settings and the display of this window from your example?

    private void ExportData(C1PrintDocument doc1)
          {
             //Change to German
             Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
             Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
             doc1.DocumentInfo.Author = "MyCompany";
             C1.C1Preview.Export.Exporter oNewExporter = doc1.ExportProviders[1].NewExporter();
             oNewExporter.Document = doc1.Document;
             oNewExporter.DocumentInfo = doc1.DocumentInfo;
             oNewExporter.ShowOptions = true;
             oNewExporter.Export("TextAreaTest2.pdf");
    
             //doc1.Export("TextAreaTest1.pdf", true);
             //Change to English after export
             Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
             Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
          }
  • Posted 15 February 2023, 7:46 pm EST - Updated 15 February 2023, 7:53 pm EST

    Hi,

    What other languages do you support besides German and

    English?

    It is possible to configure settings for a PDF file when exporting.

          private void ExportData(C1PrintDocument doc1)
          {
             //Change to German
             Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
             Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
             doc1.DocumentInfo.Author = "MyCompany";
             C1.C1Preview.Export.Exporter oNewExporter = doc1.ExportProviders[1].NewExporter();
             oNewExporter.Document = doc1.Document;
             oNewExporter.DocumentInfo = doc1.DocumentInfo;
             oNewExporter.ShowOptions = true;
             oNewExporter.Export("TextAreaTest2.pdf");
    
             //doc1.Export("TextAreaTest1.pdf", true);
             //Change to English after export
             Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
             Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
          }

    Is it possible to set these settings programmatically (e.g. disable “Use compression”) using my export example, or manage all these settings and the display of this window from your example?

  • Posted 16 February 2023, 10:43 pm EST

    Hi,

    1. We are confirming with the development team about languages support in C1Preview.C1PrintDocument. Will inform you once they respond.[Internal Tracking Id - C1WIN-29142]

    2. These properties are of PDFExporter. You can cast to PdfExporter, in order to change these values. For, e.g., you can set UseCompression=false: (see code snippet)

            private void ExportData(C1PrintDocument doc1)
            {
                //Change to German
                Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
                doc1.DocumentInfo.Author = "MyCompany";
                C1.C1Preview.Export.Exporter oNewExporter = doc1.ExportProviders[1].NewExporter();
                oNewExporter.Document = doc1.Document;
                oNewExporter.DocumentInfo = doc1.DocumentInfo;
                oNewExporter.ShowOptions = true;
                (oNewExporter as PdfExporter).UseCompression = false;// Set UseCompression programatically
                oNewExporter.Export("TextAreaTest2.pdf");
    
                //Change to English after export
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            }

    Please refer the attached sample for the same: PrintDocument_Mod2.zip

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels