pdfFlash
Create and save a PDF file that contains the data from the table (Adobe Flash - deprecated).
Please note - this property requires the Buttons extension for DataTables.
Deprecated
As of v1.2.0 this feature has been deprecated. This feature has not yet been scheduled for removal, but its use is discouraged and the alternatives discussed below should be used.
As Flash is now being expunged from all browsers, the Flash buttons are only suitable for use in old browsers. As such, they will no longer see new features developed for them after Buttons 1.2.0. They will be removed from the distribution in the next major release.
Description
This button will create and save a PDF file from the table's data.
Please note that this button has a number of restrictions:
- It does not support UTF8. For UTF-8 support please using the
pdfHtml5
button. - Adobe Flash must be installed.
- The action for this button cannot be activated using the
button().trigger()
method due to the security restrictions of Flash - The created file save dialogue must be shown and the file cannot be automatically opened.
- Adding images etc to the PDF is possible through the AlivePDF API which this button uses to create the PDF, but it is difficult and the Flash SWF must be recompiled.
The pdfHtml5
method provides much greater flexibility and thus button is considered to be sunsetted, but is still provided for use with older browsers that do not support the APIs required for the pdfHtml5
button type.
Adobe Flash is required for this button to operate. If Flash is not installed, or disabled, in the end user's browser this button will not appear. For a non-Flash alternative please see the excelHtml5
button type. Additionally the excel
will automatically select between this button and excelHtml5
depending on the features of the browser.
Options
This button can have the following options set in its configuration object to customise its actions and display:
Name | Type | Default |
---|---|---|
action | ||
Create and save a PDF file. | ||
className | buttons-pdf buttons-flash | |
The button's class name. See | ||
exportOptions | {} | |
Select the data to be gathered from the DataTable for export. This includes options for which columns, rows, ordering and search. Please see the | ||
extension | ||
The extension to give the created file name. | ||
filename | * | |
File name to give the created file (plus the extension defined by the | ||
footer | false | |
Indicate if the table footer should be included in the exported data or not. | ||
header | true | |
Indicate if the table header should be included in the exported data or not. | ||
message | ||
| ||
messageBottom Since: 1.4.0 | * | |
Message to be shown at the bottom of the table, or the | ||
messageTop Since: 1.4.0 | * | |
Message to be shown at the top of the table, or the | ||
orientation | portrait | |
Paper orientation for the created PDF. This can be | ||
pageSize | A4 | |
Paper size for the created PDF. This can be | ||
text | ||
The button's display text. The text can be configured using this option (see | ||
title | * | |
Document title (appears above the table in the generated PDF). The special character |
Examples
DataTables initialisation: Use the Flash PDF button:
$('#myTable').DataTable( {
buttons: [
'pdfFlash'
]
} );
DataTables initialisation: Use the pdf
button type to automatically select between the Flash and HTML button options.:
$('#myTable').DataTable( {
buttons: [
'pdf'
]
} );
DataTables initialisation: Use the exportOptions
to save only the data shown on the current DataTable page:
$('#myTable').DataTable( {
buttons: [
{
extend: 'pdfFlash',
text: 'Save current page',
exportOptions: {
modifier: {
page: 'current'
}
}
}
]
} );