Skip to content

Commit

Permalink
Merge pull request #5047 from gooddata/xsh-997-pdf-export-config-adju…
Browse files Browse the repository at this point in the history
…stments

feat: pdf export function adjustments to support pdf options
  • Loading branch information
PavelJiranek authored Jun 21, 2024
2 parents 713a62d + cc7e8ed commit 1ac2429
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@gooddata/sdk-ui-all",
"comment": "Adjusted export function to support pdf options.",
"type": "none"
}
],
"packageName": "@gooddata/sdk-ui-all"
}
5 changes: 3 additions & 2 deletions libs/sdk-backend-spi/api/sdk-backend-spi.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,9 @@ export type IExportDefinitionsQueryResult = IPagedResource<IExportDefinition>;

// @public
export interface IExportPdfConfig {
// (undocumented)
orientation: "portrait" | "landscape";
pdfPageSize?: string;
pdfTopLeftContent?: string;
pdfTopRightContent?: string;
}

// @public
Expand Down
7 changes: 6 additions & 1 deletion libs/sdk-backend-spi/src/workspace/execution/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export interface IExportConfig {
* @public
*/
export interface IExportPdfConfig {
orientation: "portrait" | "landscape";
/** Page size and orientation (e.g. 'a4 landscape'). */
pdfPageSize?: string;
/** PDF top left header content. */
pdfTopLeftContent?: string;
/** PDF top right header content. */
pdfTopRightContent?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ActionsApiGetTabularExportRequest,
TabularExportRequest,
TabularExportRequestFormatEnum,
Settings,
} from "@gooddata/api-client-tiger";
import {
IDataView,
Expand Down Expand Up @@ -208,11 +209,18 @@ export class TigerExecutionResult implements IExecutionResult {
? TabularExportRequestFormatEnum[uppercaseFormat]
: TabularExportRequestFormatEnum.CSV;

const settings = {
const settings: Settings = {
...(format === TabularExportRequestFormatEnum.XLSX
? { mergeHeaders: Boolean(options.mergeHeaders), showFilters: Boolean(options.showFilters) }
: {}),
...(format === TabularExportRequestFormatEnum.PDF ? options.pdfConfiguration : {}),
...(format === TabularExportRequestFormatEnum.PDF
? {
showFilters: Boolean(options.showFilters),
pdfPageSize: options.pdfConfiguration?.pdfPageSize,
pdfTopLeftContent: options.pdfConfiguration?.pdfTopLeftContent,
pdfTopRightContent: options.pdfConfiguration?.pdfTopRightContent,
}
: {}),
};

const payload: TabularExportRequest = {
Expand Down

0 comments on commit 1ac2429

Please sign in to comment.