How to Expand the PDF Reader's Bookmarks pane on opening a PDF file produced by Telerik Reporting
Environment
Product | Progress® Telerik® Reporting |
Rendering Format | |
3rd Party Application | Adobe Acrobat, Adobe Reader |
Description
When you create Telerik Reports you can provide internal navigation in the report via Document Map. This interactivity feature is supported by Adobe PDF Readers and it can be controlled by adding Adobe JavaScript in the PDF produced by the Reporting engine.
Solution
- The Adobe JavaScript that is needed is as follows:
app.execMenuItem('ShowHideBookmarks')
-
To add it in the PDF file that will be produced by Telerik Reporting, you need to pass it through the JavaScript device setting of the PDF rendering mechanism.
This can be done by:
- When you export programmatically - pass the Adobe JavaScipt as a device info (Set rendering parameters programmatically):
var deviceInfo = new System.Collections.Hashtable();
deviceInfo["JavaScript"] = "app.execMenuItem('ShowHideBookmarks')";
Dim deviceInfo As New System.Collections.Hashtable()
deviceInfo.Add("JavaScript", "app.execMenuItem('ShowHideBookmarks')")
- When you export through a Report Viewer - declare a Telerik Reporting section in the application's configuration file and set the JavaScript parameter of the PDF extension:
<configuration>
<configSections>
<section
name="Telerik.Reporting"
type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=x.x.x.x, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
…
<Telerik.Reporting>
<extensions>
<render>
<extension name="PDF" >
<parameters>
<parameter name="JavaScript" value="app.execMenuItem('ShowHideBookmarks')"/>
</parameters>
</extension>
</render>
</extensions>
</Telerik.Reporting>
…
</configuration>
In the above code snippet, you need to replace x.x.x.x with your version of Telerik Reporting e.g. 15.1.21.512.
Notes
The configuration settings valid for your Telerik Reporting version can be checked in the local help resources (CHM file) of the corresponding version.