User Tools

Site Tools


EXPORT TO PDF

Guide Section: Processing Events and Performing Actions | EASAP Tree: EVENT PROCESSING Branch


EXPORT TO PDF creates a PDF representation of a certain part of a spreadsheet.

When an EXPORT TO PDF ACTION is triggered, an image of the current state of the specified Excel range is saved as a PDF in the EASAP folder for that run.

Optionally, set Open in Browser:→TRUE to open the PDF automatically in a new browser window.

The EASA object EXPORT TO PDF is implemented via Excel and Windows and as a result, has a few limitations outlined below.


Performance Considerations

EXPORT TO PDF reopens an Excel spreadsheet; this may be time-consuming if the spreadsheet is large.

To speed up this process EXPORT TO PDF will:

  • Attempt to copy the selected portion of the spreadsheet into a new, smaller one,
    • Where Excel will generate the PDF

There are two cases where this higher-performing temporary spreadsheet will not be generated:

  1. If there is a header image or a frozen pane in Ranges:
    • The PDF will be generated directly from the original spreadsheet
  2. If there are hidden rows, an Author must decide between two options:
    1. Copy the area to a new sheet without any hidden rows,
      • → A smaller, temporary spreadsheet will be created to efficiently generate the PDF
    2. Set the following parameter to force-generate a PDF directly from the spreadsheet
      • <SERVERDATA>\easa\admin\config\System.properties
        • excel.exportToPdf.useLite=false

VBA Requirements

  • There are two requirements on VBA within the Excel spreadsheet.
    1. VBA project has to be unlocked (ie. without any password).
    2. The Authors VBA code can interfere with EXPORT TO PDF unless the macro code is modified.

Either 'disable events' as the first line of macro code, below:

If Application.EnableEvents = False Then Exit Sub

Or 'wrap' the macro code within any triggered functions to disable processing

If not Application.EnableEvents = False Then
// macro code
End If

This disables event-triggered macro's during the time EXPORT TO PDF is making its copy of the relevant parts of the spreadsheet.


EXPORT TO PDF
Essential Parameters:
Spreadsheet:The SPREADSHEET that points to the actual spreadsheet.
Output File Name:Name of the file to be created should end in → .pdf
Optional Parameters:
Open In Browser:If 'TRUE', it opens the PDF document in a web browser window when it is created, otherwise its 'FALSE'.
Type:Specify the scope of the source in the spreadsheet. ('SINGLE', 'MULTI RANGES', and 'MULTI SHEETS AND RANGES')
Delimiter:Character to delimit object references in Value: (default→%)
Sheet:Source sheet for Ranges: if Type is 'MULTI RANGES', select a sheet for use with Ranges:
Sheets:Source sheet for Ranges: if Type is 'MULTI SHEETS AND RANGES', then use a comma delimited list of the same length as the list in Ranges:
Ranges:A list of comma separated cell ranges to be pictured in the PDF, object references are allowed.
Do if:Logical expression, if 'FALSE' then action NOT performed, otherwise 'TRUE'.
Scale:Percent of the original size, creates a smaller or larger PDF. default→ 100

Notes:

  • The Ranges: parameter does not support overlapping ranges:
    • If any range specified has any part of it inside a previous range in the list,
      • The range will be skipped.
  • From Office 2007 SP3 onward, Excel supports PDF export functionality.
  • EXPORT TO PDF is affected by the operating system's DPI setting.
    • If there are different DPI settings in place for the server and the client computer,
      • Image sizes may appear mismatched or out of proportion.
  • If EXPORT TO PDF returns a 'Server Error'
    • Adjust the default printer from a physical printer in Windows to either:
      • 'Microsoft XPS Document Writer'
      • 'Microsoft Print to PDF'
  • Excel may have inconsistent behavior
    • Save a spreadsheet in 'Normal View' not 'Page View'.
  • 'Background' is not supported.

Type: → MULTISHEETS AND RANGES

Some limitations apply to EXPORT TO PDF when Type:→MULTISHEETS AND RANGES

  • Excel Headers and footers may not have images, watermarks, or text.
  • Excel 'Fit To' page scaling is not supported.
  • Scale: must be less than 100 (PDF's cannot be made larger than the Excel size)
  • Page orientation for a multiple page PDF will be set to the orientation of the first page.
  • If a sheet contains a header or footer
    • Orientation will default to 'portrait'.