Toolbar and Tools
Internally, the PDFViewer uses the Telerik UI for ASP.NET Core Toolbar and provides a set of default tools and corresponding commands in its toolbar.
This approach enables you to use the ToolBar client-side API and perform all available customizations.
You can control the number and type of the rendered tools by initializing the items collection only with the tools that you require. For the full list of configuration options, refer to the client-side API of the ToolBar items.
The toolbar collection includes the following built-in tools:
pager
zoom
zoomInOut
toggleSelection
-
search
-
open
download
print
Running an Adblock extension in Chrome might treat the new browser tab for the print dialog as a potential ad and block it.
The zoom
, zoomInOut
, toggleSelection
, search
and print
tools are available only with PDFjs processing.
The following example demonstrates basic configuration options for the PDFViewer toolbar tools. You can also add spacer
elements, in order to group a preferable set of tools.
@(Html.Kendo().PDFViewer().Name("pdfviewer")
.Toolbar(toolbar =>
toolbar.Items(items =>
{
items.Add().Name("pager");
items.Add().Name("spacer");
items.Add().Name("zoom");
items.Add().Name("zoomInOut");
items.Add().Name("toggleSelection");
items.Add().Name("search");
items.Add().Name("open");
items.Add().Name("download");
items.Add().Name("print");
})
)
)
@addTagHelper *, Kendo.Mvc
<kendo-pdfviewer name="pdfviewer">
<toolbar enabled="true">
<pdfviewer-toolbar-items>
<pdfviewer-toolbar-item name="pager">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="spacer">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="zoom">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="zoomInOut">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="toggleSelection">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="search">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="open">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="download">
</pdfviewer-toolbar-item>
<pdfviewer-toolbar-item name="print">
</pdfviewer-toolbar-item>
</pdfviewer-toolbar-items>
</toolbar>
</kendo-pdfviewer>
You can also use the add
and remove
client-side API methods to programmatically manage the rendered tools in the PDFViewer.
@(Html.Kendo().PDFViewer()
.Name("pdfviewer")
)
<kendo-pdfviewer name="pdfviewer">
</kendo-pdfviewer>
<script>
var pdfviewer = $("#pdfViewer").getKendoPDFViewer();
var printToolElement = $(".k-toolbar").find('a[title="Print"]');
pdfviewer.toolbar.remove(printToolElement);
</script>