PDFViewerBuilder
Methods
PdfjsProcessing(System.Action)
Specifies the PDF.JS configuration options. Including PDF.JS is mandatory.
Parameters
configurator - System.Action<PDFViewerPdfjsProcessingSettingsBuilder>
The action that configures the PDF.JS processing.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.PdfjsProcessing(pdf => pdf
.File(Url.Content("~/Content/web/pdfViewer/sample.pdf"))
)
)
DplProcessing(System.Action)
Specifies the DPL configuration options.
Parameters
configurator - System.Action<PDFViewerDplProcessingSettingsBuilder>
The action that configures the DPL processing.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.DplProcessing(dpl => {
dpl.Read(r => r.Url(Url.Action("GetInitialPdf", "PdfViewer")));
dpl.Upload(upload => upload.Url(Url.Action("GetPdf", "PdfViewer")).SaveField("file"));
dpl.LoadOnDemand(true);
})
)
Width(System.Double)
The width of the PDFViewer.
Parameters
value - System.Double
The value that configures the width.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Width(500)
)
Height(System.Double)
The height of the PDFViewer.
Parameters
value - System.Double
The value that configures the height.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Height(1200)
)
DefaultPageSize(System.Action)
Specifies the default page size if no PDF is displayed in the PDFViewer. The page size will shrink to fit the viewer dimensions.
Parameters
configurator - System.Action<PDFViewerDefaultPageSizeSettingsBuilder>
The action that configures the DefaultPageSize.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.DefaultPageSize(dfpagesize => dfpagesize
.Width(595)
.Height(842)
)
)
Page(System.Double)
The selected page number in the viewer.
Parameters
value - System.Double
The value that configures the page.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Page(1)
)
Scale(System.Double)
Specifies the default scale of the pages.
Parameters
value - System.Double
The value that configures the scale.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Scale(1.5)
)
ZoomMin(System.Double)
Specifies the minimum zoom that could be applied to the pages.
Parameters
value - System.Double
The value that configures the ZoomMin.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.ZoomMin(1)
)
ZoomMax(System.Double)
Specifies the maximum zoom that could be applied to the pages.
Parameters
value - System.Double
The value that configures the ZoomMax.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.ZoomMax(2)
)
ZoomRate(System.Double)
Specifies the zoom rate that could be applied to the pages. Used when zooming on mousewheel and for the zoomIn and zoomOut tools.
Parameters
value - System.Double
The value that configures the ZoomRate.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.ZoomRate(0.5)
)
View(System.Action)
Defines the page surface options. This setting is available only for DPL Processing. The page render a drawing Surface and all of its configuration options could be defined.
Parameters
configurator - System.Action<PDFViewerViewSettingsBuilder>
The action that configures the view.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.View(view => view.Type("svg"))
)
Toolbar(System.Boolean)
Toolbar option accepts a Boolean value which indicates if the toolbar will be displayed or an Object with items.
Parameters
enabled - System.Boolean
Enables or disables the toolbar option.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Toolbar(false)
)
Toolbar(System.Action)
Toolbar option accepts a Boolean value which indicates if the toolbar will be displayed or an Object with items.
Parameters
configurator - System.Action<PDFViewerToolbarSettingsBuilder>
The action that configures the toolbar.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Toolbar(toolbar =>
toolbar.Items(items =>
{
items.Add().Command("PageChangeCommand").Type("pager").Name("pager");
})
)
)
Messages(System.Action)
Specifies the localization messages of the PDFViewer.
Parameters
configurator - System.Action<PDFViewerMessagesSettingsBuilder>
The action that configures the messages.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Messages(messages => messages.DefaultFileName("PDFDocument"))
)
Document(System.String)
The client-side global variable or function to provide the JSON data for the PDF document.
Parameters
value - System.String
The value that configures the document.
Example
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
.Document("getJsonData")
)
Events(System.Action)
Configures the client-side events.
Parameters
configurator - System.Action<PDFViewerEventBuilder>
The client events action.
Example
@( Html.Kendo().PDFViewer()
.Name("PDFViewer")
.Events(events => events
.Render("onRender")
)
)
ToComponent()
Returns the internal view component.
Name(System.String)
Sets the name of the component.
Parameters
componentName - System.String
The name of the component.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Deferred(System.Boolean)
Suppress initialization script rendering. Note that this options should be used in conjunction with
Parameters
deferred - System.Boolean
ModelMetadata(System.Web.Mvc.ModelMetadata)
Uses the Metadata of the Model.
Parameters
modelMetadata - System.Web.Mvc.ModelMetadata
The metadata set for the Model
HtmlAttributes(System.Object)
Sets the HTML attributes.
Parameters
attributes - System.Object
The HTML attributes.
HtmlAttributes(System.Collections.Generic.IDictionary)
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
Render()
Renders the component.
Example
@(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
@( Html.Kendo().Grid(Model)
.Name("grid")
.DetailTemplate(product => {
)
Product Details:
<div>Product Name: @( product.ProductName )</div>
<div>Units In Stock: @( product.UnitsInStock )</div>
@(
})
.Render();
)
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.