@progress/kendo-angular-pdf-export
Version:
Kendo UI for Angular PDF Export Component
189 lines (188 loc) • 8.52 kB
TypeScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { ElementRef } from '@angular/core';
import { pdf, DrawOptions, Group } from '@progress/kendo-drawing';
import { SaveOptions } from '@progress/kendo-file-saver';
import { PDFExportTemplateDirective } from './pdf-export-template.directive';
import { PDFExportMarginComponent } from './pdf-export-margin.component';
import * as i0 from "@angular/core";
/**
* @hidden
*
* Re-export PaperSize to work around a bug in the API reference generator.
*
* The type will be linked to the kendo-drawing documentation
* by using the slug provided in api-type-links.json
*/
export type PaperSize = pdf.PaperSize;
/**
* Represents the [Kendo UI PDF Export component for Angular](slug:overview_pdfexport).
*
* @example
* ```html
* <button kendoButton (click)="pdf.saveAs('document.pdf')">
* Save As PDF...
* </button>
*
* <kendo-pdf-export #pdf paperSize="A4" margin="2cm">
* Content goes here
* </kendo-pdf-export>
* ```
*
* @remarks
* Supported children components are: {@link PDFExportMarginComponent}
*/
export declare class PDFExportComponent implements pdf.PDFOptions {
protected element: ElementRef;
/**
* If `true`, opens the Print dialog immediately after the PDF loads ([see example](slug:autoprint_pdfexport)).
* Requires `@progress/kendo-drawing` v1.9.0 or later.
* @default false
*/
autoPrint?: boolean;
/**
* Sets the author metadata for the PDF document.
*/
author: string;
/**
* Specifies whether actual hyperlinks will be produced in the exported PDF file ([see example](slug:hyperlinks_pdfexport)). You can also set a CSS selector to ignore matching links.
*/
avoidLinks: boolean | string;
/**
* Sets a CSS selector for elements that cause page breaks
* ([see example](slug:multipagecontent_pdfexport#toc-manual-page-breaking)).
*/
forcePageBreak: string;
/**
* Sets a CSS selector for elements that should not split across pages
* ([see example](slug:multipagecontent_pdfexport#toc-preventing-page-breaking-in-elements)).
*/
keepTogether: string;
/**
* Sets the creator metadata for the PDF document.
* @default "Kendo UI PDF Generator"
*/
creator: string;
/**
* Sets the creation date for the PDF document. Defaults to `new Date()`.
* @default new Date()
*/
date: Date;
/**
* Sets the image resolution in the exported PDF ([see example](slug:embeddedimages_pdfexport)). By default, images use full resolution.
*/
imageResolution: number;
/**
* Sets the name of the exported PDF file.
* @default "export.pdf"
*/
fileName: string;
/**
* If `true`, forwards content to `proxyURL` even if the browser supports local file saving.
*/
forceProxy: boolean;
/**
* Sets the keywords metadata for the PDF document.
*/
keywords: string;
/**
* If `true`, sets the page orientation to landscape. The default page orientation is portrait.
* @default false
*/
landscape: boolean;
/**
* Sets the page margins. Numbers use points (`"pt"`).
*/
margin: string | number | pdf.PageMargin;
/**
* Sets the paper size for the PDF document. Defaults to `"auto"`, which means the content determines the size of the document.
* The size of the content in pixels matches the size of the output in points (1 pixel = 1/72 inch).
*
* If set, the content splits across pages, and allows you to use `repeatHeaders`, `scale`, and a template.
*
* The value can be a `PaperSize`, an array of two numbers (width and height in points), or an array of two strings (width and height in units: `"mm"`, `"cm"`, `"in"`, or `"pt"`).
* @default "auto"
*/
paperSize: PaperSize;
/**
* If `true`, repeats the `<thead>` elements of tables on each page. This helps keep table headers visible on every page
* ([see example](slug:recurrenttableheaders_pdfexport)).
*/
repeatHeaders: boolean;
/**
* Sets a scale factor for the PDF output. Use this to make the PDF content smaller or larger
* ([see example](slug:scalingofcontent_pdfexport)).
*
* @default 1
*/
scale: number;
/**
* Sets a key/value dictionary of form values sent to the proxy. Use this to send extra data, like Anti-Forgery tokens.
*/
proxyData?: {
[key: string]: string;
};
/**
* Sets the server-side proxy URL for streaming the file to the user. You need to implement a proxy if
* the browser is not capable of saving files locally.
* The proxy returns the decoded file with the `"Content-Disposition"` header set to `attachment; filename="<fileName.pdf>"`.
*
* In the request body, the proxy receives a POST request with the specific parameters
* ([see example](slug:server_proxy#toc-implementations)).
*/
proxyURL: string;
/**
* Sets where to display the document returned from the proxy. Use `"_self"` to display in the same window.
* To display the document in a new window or iframe,
* the proxy must have the `"Content-Disposition"` header set to `inline; filename="<fileName.pdf>"`.
* @default "_self"
*/
proxyTarget: string;
/**
* Sets the producer metadata for the PDF document.
*/
producer: string;
/**
* Sets the subject metadata for the PDF document.
*/
subject: string;
/**
* Sets the title metadata for the PDF document.
*/
title: string;
/**
* @hidden
*/
pageTemplateDirective: PDFExportTemplateDirective;
/**
* @hidden
*/
marginComponent: PDFExportMarginComponent;
protected get drawMargin(): any;
protected pageTemplate: any;
constructor(element: ElementRef);
/**
* Saves the content as a PDF file with the specified name.
* @param fileName - The name of the exported file.
*/
saveAs(fileName?: string): void;
/**
* Exports the content as a `Group` for further processing.
*
* @return The root group of the exported scene.
*/
export(): Promise<Group>;
protected save(element: HTMLElement, fileName: string): void;
protected exportElement(element: HTMLElement): Promise<Group>;
protected cleanup(): void;
protected drawOptions(): DrawOptions;
protected pdfOptions(): any;
protected saveOptions(): SaveOptions;
protected drawElement(element: HTMLElement, options: DrawOptions): Promise<Group>;
protected exportGroup(group: Group, options: pdf.PDFOptions): Promise<string>;
private saveDataUri;
static ɵfac: i0.ɵɵFactoryDeclaration<PDFExportComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<PDFExportComponent, "kendo-pdf-export", never, { "autoPrint": { "alias": "autoPrint"; "required": false; }; "author": { "alias": "author"; "required": false; }; "avoidLinks": { "alias": "avoidLinks"; "required": false; }; "forcePageBreak": { "alias": "forcePageBreak"; "required": false; }; "keepTogether": { "alias": "keepTogether"; "required": false; }; "creator": { "alias": "creator"; "required": false; }; "date": { "alias": "date"; "required": false; }; "imageResolution": { "alias": "imageResolution"; "required": false; }; "fileName": { "alias": "fileName"; "required": false; }; "forceProxy": { "alias": "forceProxy"; "required": false; }; "keywords": { "alias": "keywords"; "required": false; }; "landscape": { "alias": "landscape"; "required": false; }; "margin": { "alias": "margin"; "required": false; }; "paperSize": { "alias": "paperSize"; "required": false; }; "repeatHeaders": { "alias": "repeatHeaders"; "required": false; }; "scale": { "alias": "scale"; "required": false; }; "proxyData": { "alias": "proxyData"; "required": false; }; "proxyURL": { "alias": "proxyURL"; "required": false; }; "proxyTarget": { "alias": "proxyTarget"; "required": false; }; "producer": { "alias": "producer"; "required": false; }; "subject": { "alias": "subject"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, {}, ["pageTemplateDirective", "marginComponent"], ["*"], true, never>;
}