The Event of ExportParameters in WebReport.Report

In FastReport 2020.1 we have added the ability to change export parameters. To do this, you must subscribe to the ExportParameters event in WebReport.Report.

Until now the FastReport.Net library did not provide access to the export parameters. Or rather, it did, but only to some of the parameters, and with the help of individual properties of the Web report. All these properties are piled up and working with them using intelisense is quite inconvenient, and they do not cover all the needs of users. So it was decided to give users access to all properties of the export object, using a special ExportParameters event. In the event handler you can get the export object and set all the properties you need. Thus, it is now possible to configure the export more precisely due to previously unavailable properties. This is how you can use the new event:

1
2
3
4
5
6
7
8
9
WebReport.Report.ExportParameters += (sender, e) =>
 {
 PDFExport export = e.Export as PDFExport;
 if (export != null)
 {
 export.Title = "test";
 export.DefaultPage = 2;
 }
 };

 In this example, we only changed the header and the default page. Note that we are expecting a PDF export when processing, which means that this code will not work for another type of export. In one handler you can specify settings for several export types at once.

You can specify settings for several export types at once

Now, let's take the example of PDF export as an example of how the available export properties have expanded. Previously WebReport offered us a set of export properties, which were essentially wrappers over the properties of the PDFExport export object:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 public string PdfTitle { get; set; }
 public string PdfAuthor { get; set; }
 public string PdfSubject { get; set; }
 public string PdfKeywords { get; set; }
 public string PdfCreator { get; set; }
 public string PdfProducer { get; set; }
 public string PdfUserPassword { get; set; }
 public bool PdfPrintScaling { get; set; }
 public string PdfOwnerPassword { get; set; }
 public bool PdfAllowModify { get; set; }
 public bool PdfAllowCopy { get; set; }
 public bool PdfAllowAnnotate { get; set; }
 public bool PdfA { get; set; }
 public bool PdfShowPrintDialog { get; set; }
 public bool PdfImagesOriginalResolution { get; set; }
 public bool PdfJpegCompression { get; set; }
 public bool PdfAllowPrint { get; set; }
 public bool PdfCenterWindow { get; set; }
 public bool PdfHideWindowUI { get; set; }
 public bool PdfFitWindow { get; set; }
 public bool PdfEmbeddingFonts { get; set; }
 public bool PdfBackground { get; set; }
 public bool PdfInteractiveForms { get; set; }
 public bool PdfPrintOptimized { get; set; }
 public bool PdfOutline { get; set; }
 public bool PdfDisplayDocTitle { get; set; }
 public bool PdfHideToolbar { get; set; }
 public bool PdfHideMenubar { get; set; }
 public bool PdfTextInCurves { get; set; }

 I must say that this list of properties includes the main and most popular, but not all. Many users want more. And now, with the new event ExportParameters, they have the full set of properties available:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
public bool HideWindowUI { get; set; } - hide user interface;
 public bool ShowPrintDialog { get; set; } – show printing dialog;
 public bool HideToolbar { get; set; } – hide toolbar in PDF viewer;
 public bool HideMenubar { get; set; } – hide menubar in PDF viewer;
 public GradientInterpolationPointsEnum GradientInterpolationPoints { get; set; } – gradient interpolation poinrs;
 public bool FitWindow { get; set; } – enable window fitting;
 public bool CenterWindow { get; set; } – center window;
 public bool PrintScaling { get; set; } – show scaling;
 public bool Outline { get; set; } – show contents;
 public MagnificationFactor DefaultZoom { get; set; }default zoom;
 public int RichTextQuality { get; set; } – RichText quality;
 public bool Compressed { get; set; } – compress file;
 public bool TransparentImages { get; set; } – transparent image;
 public bool DisplayDocTitle { get; set; } – display document title;
 public int DefaultPage { get; set; }default page number;
 public byte[] ColorProfile { get; set; } – color profile;
 public ExportType ExportMode { get; set; } – export type;
 public bool InteractiveForms { get; set; } – enable interactive forms;
 public bool IsDigitalSignEnable { get; set; } – enable digital signature;
 public bool SaveDigitalSignCertificatePassword { get; set; } – save digital signature certificate password;
 public X509Certificate2 DigitalSignCertificate { set; } – digital signature certificate;
 public string DigitalSignCertificatePath { get; set; } – digital signature certificate path;
 public string DigitalSignCertificatePassword { set; }; digital signature certificate password
 public string DigitalSignLocation { get; set; } – digital signature location;
 public string DigitalSignReason { get; set; } – digital signature reason;
 public string DigitalSignContactInfo { get; set; } – digital signature contact info;
 public CurvesInterpolationEnum CurvesInterpolation { get; set; } – curves interpolation;
 public bool AllowAnnotate { get; set; } – allow annotation;
 public bool AllowCopy { get; set; } – allow copying;
 public bool AllowModify { get; set; } – allow editing;
 public bool AllowPrint { get; set; } – allow print;
 public GradientQualityEnum GradientQuality { get; set; } – gradient quality;
 public PdfStandard PdfCompliance { get; set; } – PDF standard complience;
 public bool EmbeddingFonts { get; set; } – enable embedded fonts;
 public bool Background { get; set; } – enable background;
 public CurvesInterpolationEnum CurvesInterpolationText { get; set; } – interpolation text curves;
 public PdfColorSpace ColorSpace { get; set; } – color space;
 public bool ImagesOriginalResolution { get; set; } – use original image resolution;
 public bool PrintOptimized { get; set; } – print optimization;
 public bool JpegCompression { get; set; } – Jpeg image compression;
 public bool TextInCurves { get; set; } – make text in curves;
 public string Title { get; set; } – title;
 public string UserPassword { get; set; } – user password for encrypted documents;
 public int JpegQuality { get; set; } – Jpeg image quality;
 public string OwnerPassword { get; set; } – Owner’s password;
 public string Producer { get; set; } – Producer;
 public bool SvgAsPicture { get; set; } – Display Svg objects as pisctures;
 public string Keywords { get; set; } – Keywords;
 public string Subject { get; set; } – Subject of the document;
 public string Author { get; set; } – Author;
 public string Creator { get; set; } – Creator;

 And this is without considering the properties common to all exports.

Let's summarize what benefits the new ExportParameters event brings us. By using an object for a specific export, we can only access the properties of that export. Previously, it was required to select from a common list of properties of all possible exports, which is not always convenient, because the names of some properties are not obvious to identify the export. You will see the full list of available properties using Intellisense or you can see the full list of available properties.

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.
Trustpilot