PdfExport

Generates PDF/PNG files from the Scheduler component.

Scheduler Export dialog

A server-side service is required to perform the export operation. Check out PDF Export Server documentation and installation steps here

When your server is up and running, it listens to requests. The Export feature sends a request to the specified URL with the HTML fragments. The server generates a PDF (or PNG) file and returns a download link (or binary, depending on sendAsBinary config). Then the Export feature opens the link in a new tab and the file is automatically downloaded by your browser. This is configurable, see openAfterExport config.

The exportServer URL must be configured. The URL can be localhost if you start the server locally, or your remote server address.

This feature will not work properly when ResourceStore has lazyLoad

Usage

const scheduler = new Scheduler({
    features : {
        pdfExport : {
            exportServer : 'http://localhost:8080' // Required
        }
    }
})

// Opens popup allowing to customize export settings
scheduler.features.pdfExport.showExportDialog();

// Simple export
scheduler.features.pdfExport.export({
    // Required, set list of column ids to export
    columns : scheduler.columns.map(c => c.id)
}).then(result => {
    // Response instance and response content in JSON
    let { response, responseJSON } = result;
});

Appends configs related to exporting time axis: scheduleRange, rangeStart, rangeEnd

Loading resources

If you face a problem with loading resources when exporting, the cause might be that the application and the export server are hosted on different servers. This is due to Cross-Origin Resource Sharing (CORS). There are 2 options how to handle this:

  • Allow cross-origin requests from the server where your export is hosted to the server where your application is hosted;
  • Copy all resources keeping the folder hierarchy from the server where your application is hosted to the server where your export is hosted and setup paths using translateURLsToAbsolute config and configure the export server to give access to the path:
const scheduler = new Scheduler({
    features : {
        pdfExport : {
            exportServer : 'http://localhost:8080',
            // '/resources' is hardcoded in WebServer implementation
            translateURLsToAbsolute : 'http://localhost:8080/resources'
        }
    }
})
// Following path would be served by this address: http://localhost:8080/resources/
node ./src/server.js -h 8080 -r web/application/styles

where web/application/styles is a physical root location of the copied resources, for example:

Export server structure with copied resources

This feature is disabled by default. For info on enabling it, see GridFeatures.

Configs

40

Common

disabledInstancePlugin
listenersEvents

Export file config

rangeEnd: Date

Exported time span range end. Used with daterange config of the scheduleRange

Exported time span range start. Used with daterange config of the scheduleRange

scheduleRange: completeview | currentview | daterange= completeview

Specifies how to export time span.

  • completeview - Complete configured time span, from scheduler start date to end date
  • currentview - Currently visible time span
  • daterange - Use specific date range, provided additionally in config. See rangeStart/ rangeEnd
fileFormatPdfExport
fileNamePdfExport
orientationPdfExport
paperFormatPdfExport
rowsRangePdfExport

Other

alignRowsPdfExport
clientURLPdfExport
exportersPdfExport
exporterTypePdfExport
exportMaskPdfExport
exportServerPdfExport
fetchOptionsPdfExport
footerTplPdfExport
headerTplPdfExport
keepPathNamePdfExport
lockPaperSizePdfExport
openInNewTabPdfExport
repeatHeaderPdfExport
sendAsBinaryPdfExport

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Properties

21

Common

disabledInstancePlugin

Class hierarchy

isPdfExport: Boolean= truereadonly
Identifies an object as an instance of PdfExport class, or subclass thereof.
isPdfExport: Boolean= truereadonlystatic
Identifies an object as an instance of PdfExport class, or subclass thereof.
isEventsEvents
isInstancePluginInstancePlugin
isLocalizableLocalizable

Other

Returns the instantiated export dialog widget as configured by exportDialog

isExportingPdfExport

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Functions

33

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

exportPdfExport
filterStylesPdfExport
LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

8
catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin
exportStepPdfExport
pdfExportPdfExport

Event handlers

8
onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin
onExportStepPdfExport
onPdfExportPdfExport

Typedefs

1