User Tools

Site Tools


EXPORT TO PDF

Guide Section: Processing Events and Performing Actions
EASAP Tree: EVENT PROCESSING > ACTION / PROCESSES


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

When an EXPORT TO PDF 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.

EXPORT TO PDF is implemented via Excel and Windows and as a result, has the 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, and then will generate the PDF from the subset spreadsheet.

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

A. If there is a header image or a frozen pane in Ranges: the PDF will be generated directly from the original spreadsheet

B. 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 in: <SERVERDATA>\easa\admin\config\System.properties
    excel.exportToPdf.useLite=false
    (an Excel 365/2016 update since build 11231.xxxxx requires setting the above property)

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 Author's 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:Enter a literal, SCALAR or FILE CHOICE reference as a name for the file to be created \
Should end in .pdf
Optional Parameters:
Type:Specify the scope of the source in the spreadsheet,
SINGLE
MULTI RANGES
MULTI SHEETS AND RANGES
Delimiter:Set a character to delimit object references in Value:
Default: %
Sheet:Select a SHEET source for Ranges:
If Type:MULTI RANGES select a sheet for use with Ranges:
Sheets:source SHEET for Ranges:
If Type: MULTI SHEETS AND RANGES then use a comma delimited list of the same length as the list in Ranges:
Range:Enter a literal or a SCALAR reference with a cell range to be pictured in the PDF
Ranges:Enter a comma-separated list of literal, SCALAR and/or LIST references of cell ranges to be pictured in the PDF
Do if:Enter a logical expression, if true then export is performed and otherwise not
Scale:
when Type: MULTI SHEETS AND RANGES
Enter a percent of the original size to create a smaller
Default: 100
Must be less than or equal to 100
USER INTERFACE branch only
Open In Browser:Set to TRUE to open the PDF document in a web browser window when it is created
Default: FALSE
OUTPUT branch only
Queue:Set to TRUE to avoid running out of Excel processes resulting in an exception

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 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
    • page orientation will default to portrait