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,
                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'                                     
Save as Archive - export all report pages as an archive file (zip format) or as individual HTML pages. multiPage: true
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'));

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