New to Telerik UI for ASP.NET MVC? Download free 30-day trial

PDFSettingsBuilder

The fluent API for configuring the grid PDF export.

Methods

AllPages()

Exports all pages. Applicable only for the Grid. Ajax binding or server binding with ServerOperation(false) is required.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.AllPages())
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .ServerOperation(false)
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Does not create clickable hyperlinks in the exported PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.AvoidLinks())
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

AvoidLinks(System.Boolean)

A flag indicating whether to produce clickable hyperlinks in the exported PDF file.

Parameters

avoidLinks - System.Boolean

A flag indicating whether to produce actual hyperlinks in the exported PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.AvoidLinks(true))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

AvoidLinks(System.String)

A CSS selector for the links to ignore. All matching links will not be clickable in the exported PDF file.

Parameters

avoidLinks - System.String

A CSS class parameter. All matching links will not be clickable in the exported PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.AvoidLinks("avoidLinkClass"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Landscape()

Turns the page in landscape orientation.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Landscape())
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

FileName(System.String)

Sets the file name of the PDF file.

Parameters

fileName - System.String

Specifies the file name of the exported PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.FileName("Products.pdf"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

PaperSize(System.String)

Specifies a predefiend paper size e.g. "A3", "A4" or "auto" (default).

Parameters

paperSize - System.String

Specifies the paper size.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.PaperSize("A3"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

PaperSize(System.Double,System.Double)

Specifies custom paper size in "pt" units.

Parameters

width - System.Double

Specifies the width size of the PDF in "pt" units.

height - System.Double

Specifies the height size of the PDF in "pt" units.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.PaperSize(20, 20))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

PaperSize(System.String,System.String)

Specifies custom paper size in custom units ("in", "mm", "pt", "cm")

Parameters

width - System.String

Specifies the width size of the PDF.

height - System.String

Specifies the height size of the PDF.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.PaperSize("15pt", "20cm"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

ProxyURL(System.String)

Set the url of the server side proxy. The proxy is responsible for returning the PDF to the end user. Used in browsers that don't support saving files from JavaScript.

Parameters

url - System.String

The URL of the server side proxy which will stream the file to the end user.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.ProxyURL("/save"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

ProxyTarget(System.String)

Set the a name or keyword indicating where to display the document returned from the proxy. The default is "_self".

Parameters

target - System.String

The proxy target

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.ProxyTarget("_blank"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Margin(System.Double,System.Double,System.Double,System.Double)

Specifies the margins in "pt" units.

Parameters

top - System.Double

Specifies the top margin in "pt" units.

right - System.Double

Specifies the right margin in "pt" units.

bottom - System.Double

Specifies the bottom margin in "pt" units.

left - System.Double

Specifies the left margin in "pt" units.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Margin(10, 10, 10, 10))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Margin(System.String,System.String,System.String,System.String)

Specifies the margins in units ("in", "mm", "pt", "cm")

Parameters

top - System.String

Specifies the top margin.

right - System.String

Specifies the right margin.

bottom - System.String

Specifies the bottom margin.

left - System.String

Specifies the left margin.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Margin("10in", "10mm", "10pt", "10cm"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Title(System.String)

Sets the title of the PDF document.

Parameters

title - System.String

The title of the PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Title("Orders"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Author(System.String)

Sets the author of the PDF document.

Parameters

author - System.String

The author of the PDF document.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Author("John Doe"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Subject(System.String)

Sets the subject of the PDF document.

Parameters

subject - System.String

The subject value of the PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Subject("Products"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Keywords(System.String)

Sets the keywords of the PDF document.

Parameters

keywords - System.String

Specifies the keywords of the exported PDF file.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Keywords("northwind products"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

RepeatHeaders(System.Boolean)

Set this to true to repeat the grid headers on each page.

Parameters

value - System.Boolean

The value for RepeatHeaders

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.RepeatHeaders(true))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

RepeatHeaders()

Set this to true to repeat the grid headers on each page.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.RepeatHeaders(true))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Scale(System.Double)

A scale factor. In many cases, text size on screen will be too big for print, so you can use this option to scale down the output in PDF.

Parameters

scale - System.Double

The value for the scale factor.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Scale(1))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Template(System.String)

Parameters

value - System.String

TemplateId(System.String)

A piece of HTML to be included in each page. Can be used to display headers and footers. See the documentation in drawDOM.

Parameters

templateId - System.String

The ID of the template element for Template

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.TemplateId("page-template").AllPages().PaperSize("A3"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Creator(System.String)

Sets the creator of the PDF document.

Parameters

creator - System.String

The creator of the PDF document.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Creator("John Doe"))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

Date(System.DateTime)

Sets the date of the PDF document.

Parameters

date - System.DateTime

The date when the PDF document is created.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.Date(DateTime.Now))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

ForceProxy(System.Boolean)

Forces the use of server-side proxy even if the browser supports local saving.

Parameters

forceProxy - System.Boolean

true if the server proxy should be used always; false for automatic detection

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.ForceProxy(true))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

AutoPrint(System.Boolean)

Specifies if the Print dialog should be opened immediately after loading the document.

Parameters

value - System.Boolean

The value that configures the autoprint.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.AutoPrint(false))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

JpegQuality(System.Double)

Specifies the quality of the images within the exported file, from 0 to 1.

Parameters

value - System.Double

The value that configures the jpegquality.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.JpegQuality(0.85))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

KeepPNG(System.Boolean)

If set to true all PNG images contained in the exported file will be kept in PNG format.

Parameters

value - System.Boolean

The value that configures the keeppng.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .ToolBar(t => t.Pdf())
                .Pdf(pdf => pdf.KeepPNG(true))
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

In this article
Not finding the help you need?