# Angular Spreadsheet PDF Export

The Spreadsheet provides built-in support for exporting the active worksheet to a PDF file directly from the browser. The export renders the sheet content, including cell values, formatting, and column widths, as a print-ready PDF document.

The following example demonstrates the PDF export feature with a products inventory Spreadsheet. In the **File** menu, click the **Export as PDF...** option to download the file. Use the configuration panel to adjust the export settings before downloading.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/spreadsheet/pdf-export/source.txt)

## Configuring the Export

To control the PDF output, bind a [`PDFExportSettings`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings) object to the [`pdfExportSettings`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/spreadsheetcomponent#pdfexportsettings) input. The object lets you specify the paper size and orientation, page margins, whether the content should scale to fit the page width, the name of the downloaded file, and the document title metadata.

Use [`fileName`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#filename) to control the name of the downloaded file. If not set, the file is saved as `'Workbook.pdf'` by default. You can also set the [`title`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#title) property to embed a descriptive title in the PDF document metadata, which PDF readers display in the document properties panel. If `title` is not set, it defaults to the value of `fileName`.

```TypeScript
public pdfExportSettings: PDFExportSettings = {
    paperSize: 'A4',
    landscape: true,
    margin: '1cm',
    fitWidth: false,
    title: 'Products Inventory',
    fileName: 'Products-Inventory.pdf'
};
```

```HTML
<kendo-spreadsheet
    [sheets]="sheets"
    [pdfExportSettings]="pdfExportSettings">
</kendo-spreadsheet>
```

## Setting the Page Layout

The layout properties control how the sheet content renders on the PDF page. You can set the [paper size](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/import-export/pdf-export#paper-size), [orientation](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/import-export/pdf-export#orientation), and [margins](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/import-export/pdf-export#margins) independently to match your printing requirements.

### Paper Size

Use [`paperSize`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#papersize) to set the paper dimensions. The property accepts a [`SpreadsheetPaperSize`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/spreadsheetpapersize) string for standard sizes such as `'A4'` or `'Letter'`, or a `[width, height]` array in points for custom dimensions. The default value is `'A4'`.

```typescript
// Standard paper size
public pdfExportSettings: PDFExportSettings = { paperSize: 'A4' };

// Custom dimensions in points (width × height)
public pdfExportSettings: PDFExportSettings = { paperSize: [595, 842] };
```

### Orientation

Set [`landscape`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#landscape) to `false` to switch to portrait orientation. The default is landscape, which suits most wide Spreadsheet layouts.

```typescript
public pdfExportSettings: PDFExportSettings = {
    paperSize: 'A4',
    landscape: false
};
```

### Margins

Use [`margin`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#margin) to control the whitespace around the content. It accepts a string with units (`"mm"`, `"cm"`, `"in"`, `"pt"`), a plain number in points, or a [`PDFMargin`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfmargin) object when you need different values for each side. The default is `'1cm'`.

```typescript
// Uniform margin
public pdfExportSettings: PDFExportSettings = { margin: '1.5cm' };

// Per-side margin
public pdfExportSettings: PDFExportSettings = {
    margin: {
        top: '2cm',
        bottom: '2cm',
        left: '1cm',
        right: '1cm'
    }
};
```

## Fitting and Scaling Content

When your sheet has more columns than can fit within the selected paper size, use [`fitWidth`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#fitwidth) to automatically scale the content down so the entire row fits on a single page. This is the quickest way to avoid columns being clipped or wrapping to a second page. When `fitWidth` is `true`, the [`scale`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings#scale) property is ignored.

For more precise control, use `scale` directly. A value of `0.8` renders the content at 80% of its original size, which is useful when you need a consistent reduction across all sheets regardless of their width.

```typescript
// Fit the sheet to the page width
public pdfExportSettings: PDFExportSettings = {
    paperSize: 'A4',
    fitWidth: true
};

// Or apply a fixed scale instead
public pdfExportSettings: PDFExportSettings = {
    paperSize: 'A4',
    scale: 0.8
};
```

## Suggested Links

* [Excel Import and Export](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/import-export/excel)
* [JSON Import and Export](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/import-export/json)
* [API Reference of the `PDFExportSettings`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/pdfexportsettings)
* [API Reference of the `SpreadsheetComponent`](https://www.telerik.com/kendo-angular-ui-develop/components/spreadsheet/api/spreadsheetcomponent)
