Edit this page

How to set the default PDF view size to 100%

Environment

Product ProgressĀ® TelerikĀ® Reporting
Rendering Format PDF

Description

This article describes how to change the default zoom level options in PDF Viewer Tool as they are set to "automatic" most commonly.

Solution

The default PDF viewer zoom level could be changed in three ways:

  1. Change the settings of the PDF Viewer tool

    • Open Acrobat Reader, navigate to Edit menu -> Preferences -> Page Display -> set your required Zoom percentage.
    • Click OK to confirm the change.
    • Relaunch Acrobat Reader to test
  2. Change the settings programmatically with Telerik.Reporting configuration section in application configuration file

    This setting could be added to Telerik.Reporting Configuration Section Extension Element by using JavaScript as name attribute and value this.zoom=100 like the following code snippet:

    <Telerik.Reporting>
       <extensions>
          <render>
            <extension name="PDF">
              <parameters>
                <parameter name="JavaScript" value="this.zoom=100"/>
              </parameters>
            </extension>
          </render>
        </extensions>
    </Telerik.Reporting>
    
  3. With the using of the ReportProcessor.RenderReport Method to render the report in the specified format

    There is a parameter called deviceInfo that contains parameters to pass to the rendering extension. Based on the Export Report Programmatically: Exporting a report to a single document format example, is created the following code snippet for this case:

    Telerik.Reporting.Processing.ReportProcessor reportProcessor =
        new Telerik.Reporting.Processing.ReportProcessor();
    
    // set any deviceInfo settings if necessary
    System.Collections.Hashtable deviceInfo =
        new System.Collections.Hashtable();
    
    deviceInfo["JavaScript"] = "this.zoom=100";
    
    Telerik.Reporting.TypeReportSource typeReportSource =
                 new Telerik.Reporting.TypeReportSource();
    
    // reportName is the Assembly Qualified Name of the report
    typeReportSource.TypeName = reportName;
    
    Telerik.Reporting.Processing.RenderingResult result =
        reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo);
    
    string fileName = result.DocumentName + "." + result.Extension;
    string path = System.IO.Path.GetTempPath();
    string filePath = System.IO.Path.Combine(path, fileName);
    
    using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
    {
        fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
    }
    
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy