V1
V1

Set Document Properties

The properties of the exported document can be set without previewing the report, as explained in this section.

PDF

The following code specifies export settings for PDF.

function load() {
            var ARJS = GC.ActiveReports.Core;
            var PDF = GC.ActiveReports.PdfExport;

            var onProgressCallback = function (pageCount) {
                console.log(pageCount);
            }

            var settings = {
                info: {
                    title: 'Invoice List',
                    subject: 'This is the Invoice List',
                    author: 'John K',
                    keywords: 'PDF; import; export'
                },
                security:
                {
                    userPassword: 'user_Pwd',
                    ownerPassword: 'owner_Pwd',
                    permissions: {
                        printing: 'lowResolution',
                        modifying: true,
                        annotating: true,
                        copying: true,
                        contentAccessibility: false,
                        documentAssembly: false
                    }
                },
                pdfVersion:"1.5",
                autoPrint: true,
                fonts: [

                    {
                        name: 'SimSun-ExtB',
                        source: '/fonts/simsunb.ttf'
                    },
                    {
                        name: 'Matura MT Script Capitals',
                        source: '/fonts/MATURASC.TTF',
                    },
                    {
                        name: 'Stencil',
                        source: '/fonts/STENCIL.ttf'
                    }
                ]

            }
            var pageReport = new ARJS.PageReport();
            pageReport.load('/reports/InvoiceList.rdlx-json')
                .then(() => pageReport.run())
                .then(pageDocument => PDF.exportDocument(pageDocument, settings, onProgressCallback))
                .then(result => result.download('InvoiceList'));

        }

Note:

  • The default PDF Version (1.3) allows setting only 4 base types of permissions: printing, modifying, copying, and annotating. All other permissions need PDF 1.4+.
  • Document assembly is always displayed as "Not allowed" in the Adobe Acrobat Reader (and possibly in other reader applications), as this application does not allow combining documents at all. The Adobe Acrobat should show the real state of assembly permission.
Description of PDF export settings Sample code
Title - title of the document. info: {title: 'Invoice List'}                                                              
Author - name of the author that appears in the document properties of the viewer application. info: {author: 'John K'}
Keywords - keywords associated with the document. info: {keywords: 'PDF; import; export'}
Subject - subject of the document. info: {subject: 'This is the Invoice List'}
User Password - the user password that can be entered in the reader. If this value is left empty, the user will not be prompted for a password, however the user will be restricted by the specified permissions. security: {userPassword: 'user_Pwd'}
Owner Password - the owner password that can be entered in the reader that permits full access to the document regardless of the specified user permissions. security: {ownerPassword: 'owner_Pwd'}
Allow Printing - allow printing of the document in Low or High resolution. security: {permissions: {printing: 'lowResolution'}}
Allow Copying - allow content copy from the document. security: {permissions: {copying: true}}
Allow Modifying - allow editing in the document. security: {permissions: {modifying: true}}
Allow Annotating - allow adding or editing annotations. security: {permissions: {annotating: true}}
Allow Content Accessibility - allow text extraction or accessibility. security: {permissions: {contentAccessibility: false}}
Allow Document Assembly - allow combining PDF documents. security: {permissions: documentAssembly: false}}
PDF Version - allow setting PDF version - 1.3, 1.4, 1.5, 1.6, 1.7, and 1.7ext3. pdfVersion:"1.5"
Print on Open - indicates whether the document should be printed after open. autoPrint: true
File Name - name of the exported PDF document. .then(result => result.download('InvoiceList'));

Excel

The following code specifies export settings for Excel.

function load() {
            var ARJS = GC.ActiveReports.Core;
            var Excel = GC.ActiveReports.XlsxExport;

            var onProgressCallback = function (pageCount) {
                console.log(pageCount);
            }

            var settings = {
                info: {
                    creator: 'Jack'
                },
                sheetName: 'Sheet_Details',
                pageSettings: {
                    size:'A4',
                    orientation: 'landscape'
                },
                password: 'password'
            }
            var pageReport = new ARJS.PageReport();
            pageReport.load('/reports/InvoiceList.rdlx-json')
                .then(() => pageReport.run())
                .then(pageDocument => Excel.exportDocument(pageDocument, settings, onProgressCallback))
                .then(result => result.download('InvoiceList'));
        }
Description of Excel export settings Sample code
Author - name of the author that appears in the document properties of the viewer application. info: {creator: 'Jack'}
Size - size of the Excel document - Letter, Legal, A4, etc. size:'A4'
Orientation - orientation of the Excel document - Portrait or Landscape. pageSettings: {orientation: 'landscape'}
Sheet Name - name of the Excel document or sheet. sheetName: 'Sheet_Details'
Password - password to open the Excel document. password: 'password'
File Name - name of the exported Excel document. .then(result => result.download('InvoiceList'));

HTML

The following code specifies export settings for HTML.

function load() {
            var ARJS = GC.ActiveReports.Core;
            var HTML = GC.ActiveReports.HtmlExport;

            var onProgressCallback = function (pageCount) {
                console.log(pageCount);
            }

            var settings = {
                autoPrint: true,
                multiPage: true,
                embedImages: 'embed',
                outputType: 'zip',
                renderOptions: {
                    galleyMode: true //property available only through API
                }
            }

            var pageReport = new ARJS.PageReport();
            pageReport.load('/reports/InvoiceList.rdlx-json')
                .then(() => pageReport.run())
                .then(pageDocument => HTML.exportDocument(pageDocument, settings, onProgressCallback))
                .then(result => result.download('InvoiceList'));

        }
Description of HTML export settings Sample code
Title - title of the document. title: 'Invoice List'                                     
Print on Open - indicates whether the document should be printed on opening. autoPrint: true
File Name - name of the exported HTML document. .then(result => result.download('InvoiceList'));
Multi Page - export all report pages as an archive file (zip format) or as individual HTML pages. multiPage: true
Embed Images - specify how to export images or reference to the images
None: the image appears as in the url pointing to the image path. There is no image file.
Embed: converts each image in base64 and embeds into HTML page.
External: exports to a .zip folder with exported HTML file(s) and all images in a separate folder, and updates links in HTML/CSS.
embedImages: 'none'|'embed'|'external'
Output Type -
Auto: the default setting - automatically uses the best possible output, HTML or Archive, according to the compatibility of the export options.
HTML: a single html file is generated even if report contains multiple pages.
Archive: exports to a .zip folder containing HTML file(s) depending on the choice for multi page.
outputType: 'html'|'zip'|'auto'

Note: Please note the export behavior in case of following combination of settings:

  • Output Type as HTML and Multi Page as true is not compatible: it is because multi-page export is available only for Archive output type.
  • Output Type as HTML and Embed Images as External is not compatible: It is because Embed Images as external files is available only for Archive output type.
  • Report is exported anyway as an archive when 'Embed Images' is 'External'. Depending on the 'Multi Page' as true or false, report is exported as an archive with multiple or single html file(s) with all report pages, and all external images of report in a separate folder, and a css file.

Limitations

PDF

  • PDF Print Presets are not available.
  • PDF/A format is not supported.
  • Watermarks can not be added.
  • No fonts fallback property to locate missing glyphs.
  • Only JPG and PNG images can be exported. Gif, bmp, emf, tiff, wmf are not exported.
  • Vertical text is not supported.
  • TextDecoration - Overline is not supported.
  • Report navigates to the page where bookmark is present, and not to specific control whose bookmark id is specified.

Excel

  • Slanted lines are not supported.

HTML

  • HTML is not the best format for printing. Use other exports instead.

The following table lists the properties that are not supported either in PDF or Excel export.

Properties Support in PDF Support in Excel
Report - Bookmark Y N
TextBox - CharacterSpacing Y N
TextBox - LineSpacing N N
Image - Alignment Y N
Image - Action Y N
Image - BackgroundRepeat N N
Image - Sizing N Y
Shape - RoundingRadius Y N
Shape - Style Y N
Table - AutoMergeMode N N
Table - WritingMode N N
Line - LineWidth Y N
Subreport - SubstituteThemesOnSubreport N N
Tablix - WritingMode N N