# PDF Export Configuration

This article covers the options that define the page setup of the exported PDF file—the basic [`PDFOptions`](https://www.telerik.com/kendo-angular-ui-develop/components/drawing/api/pdf/pdfoptions), how to scale the content, and how CSS units map to PDF units.

The Drawing library provides options for specifying the basic parameters of the generated PDF file.

<table>
    <colgroup>
        <col width="18%" />
        <col />
        <col width="15%" />
    </colgroup>
    <thead>
        <tr>
            <th>Option</th>
            <th>Description</th>
            <th>Default</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><a href="/drawing/api/pdf/pdfoptions#papersize"><code>paperSize</code></a></td>
            <td>A paper format (for example, <code>A4</code>), an array of two numbers for the width and height of the paper, or <code>"auto"</code> to size the paper just enough to accommodate the drawing.</td>
            <td><code>"auto"</code></td>
        </tr>
        <tr>
            <td><a href="/drawing/api/pdf/pdfoptions#margin"><code>margin</code></a></td>
            <td>The paper margins&mdash;an object with <code>top</code>, <code>left</code>, <code>right</code>, and <code>bottom</code> numbers. When <code>paperSize</code> is <code>"auto"</code>, the dimensions expand to include the margin.</td>
            <td>None</td>
        </tr>
        <tr>
            <td><a href="/drawing/api/pdf/pdfoptions#landscape"><code>landscape</code></a></td>
            <td>Rotates the paper dimensions so that the width corresponds to the longer side of the output file.</td>
            <td><code>false</code></td>
        </tr>
        <tr>
            <td><a href="/drawing/api/pdf/pdfoptions#multipage"><code>multiPage</code></a></td>
            <td>Enables multiple-page output. For a detailed walkthrough, see <a href="/drawing/pdf-output/multi-page-content">Multi-Page Content</a>.</td>
            <td><code>false</code></td>
        </tr>
        <tr>
            <td><a href="/drawing/api/pdf/pdfoptions#date"><code>date</code></a></td>
            <td>The date on which the document is created.</td>
            <td><code>new Date()</code></td>
        </tr>
        <tr>
            <td>
                <a href="/drawing/api/pdf/pdfoptions#title"><code>title</code></a>,
                <a href="/drawing/api/pdf/pdfoptions#author"><code>author</code></a>,
                <a href="/drawing/api/pdf/pdfoptions#subject"><code>subject</code></a>,
                <a href="/drawing/api/pdf/pdfoptions#keywords"><code>keywords</code></a>,
                <a href="/drawing/api/pdf/pdfoptions#creator"><code>creator</code></a>
            </td>
            <td>Optional strings included in the PDF information dictionary.</td>
            <td>None</td>
        </tr>
    </tbody>
</table>

The `paperSize` property accepts the standard formats `A0`–`A10`, `B0`–`B10`, `C0`–`C10`, `Executive`, `Folio`, `Legal`, `Letter`, and `Tabloid`. Numbers are treated as typographic points (1/72 of an inch), and you can also use unit strings such as `"297mm"` with the `mm`, `cm`, `in`, or `pt` units. The same units apply to `margin`.

## Scaling the Drawings

The Drawing library enables you to export a PDF document that is bigger or smaller than its original elements.

Scaling is convenient when you generate a multi-page PDF with automatic page breaking. Because the original dimensions usually look too big in PDF, you can specify a suitable scale factor to get a better output for print. To scale the content, use the [`scale`](https://www.telerik.com/kendo-angular-ui-develop/components/drawing/api/drawoptions#scale) option.

> Scaling affects only the content—the output paper size and page margins remain the same. However, scaling still affects the position of the headers and footers of page templates.

For more information on how to scale the content with the PDF Export component, refer to its [documentation](https://www.telerik.com/kendo-angular-ui-develop/components/pdf-export/content-scaling).

The following example demonstrates how to set a scale factor of `0.8` and keep an A4 page size and a two-centimeter page margin.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/drawing/pdf-output/scaling-the-drawings/source.txt)

## Dimensions and CSS Units

> Set all your dimensions in `px`. Values in `cm`, `in`, `mm`, or `pt` lead to unpredictable results in the exported PDF.

To draw the DOM, the module inspects the computed styles of the elements, and the browser always returns computed styles in pixels. For example, a `<div style="width: 1cm">` element renders on screen as exactly `1cm` wide when the dots-per-inch (DPI) setting is correctly detected. However, when you query its computed style, you get back a value such as `37.78125px`, which can vary depending on the display.

Because the computed style yields pixels, the PDF generator keeps a 1:1 mapping between screen pixels and the default PDF unit, the [typographic point (pt)](http://en.wikipedia.org/wiki/Point_%28typography%29). As a result, the same element renders in the PDF with a length of `37.78125pt`. Two constants define the relationship between these units:

* `1 pt = 1/72 in` (points to inches)
* `1 in = 2.54 cm` (inches to centimeters)

Combined, these constants produce `37.78125 pt = 37.78125 / 72 in &asymp; 1.33 cm`. This means that although you specify a dimension of `1cm` in your CSS, the exported PDF renders it as `1.33cm`—not the value you intended.

To get a predictable layout in PDF, convert your dimensions to pixels before you apply them by using the following formulas. The `paperSize` and `margin` options are exceptions to this behavior—because they are neither related to CSS nor to the display resolution, you can use any of the supported unit types with them.

| Source unit        | Formula                | Approximate factor         |
| ------------------ | ---------------------- | -------------------------- |
| Centimeters (`cm`) | `N cm = N * 28.346 px` | `72 / 2.54 &asymp; 28.346` |
| Inches (`in`)      | `N in = N * 72 px`     | `72`                       |

## Suggested Links

* [Multi-Page Content](https://www.telerik.com/kendo-angular-ui-develop/components/drawing/pdf-output/multi-page-content)
* [API Reference of the Drawing Library](https://www.telerik.com/kendo-angular-ui-develop/components/drawing/api)
* [PDF Options by the Drawing Library](https://www.telerik.com/kendo-angular-ui-develop/components/drawing/api/pdf/pdfoptions)
* [DrawOptions](https://www.telerik.com/kendo-angular-ui-develop/components/drawing/api/drawoptions)
* [API Reference of the PDF Export Component](https://www.telerik.com/kendo-angular-ui-develop/components/pdf-export/api/pdfexportcomponent)
