Print functionality in the HTML5 report viewer is not working with PDF/A compliance level
Environment
Product | Progress® Telerik® Reporting |
Report Viewer | HTML5 |
Description
The printing functionality of the Html5 Report Viewer uses PDF with injected custom JavaScript to force the Print dialog of the browser PDF plug-in to pop up - Printing Reports.
PDF/A standards do *not* support JavaScript in the PDF document (check for example PDF/A Wikipedia article). Therefore, an error would be thrown when PDF rendering extension compliance level is different from the default (None).
Error Message
{"message":"","exceptionMessage":"The used Compliance Level is not supported with immediate print. The immediate print requires script inclusion.","exceptionType":"Telerik.Reporting.Services.Engine.DocumentRenderException"...}
Solution
The avoid the problem it is necessary to configure a second entry for PDF/A rendering using the approach explained in the Configuring Multiple Entries for a Rendering Extension article section.
The following configuration code will introduce a new Export entry (PdfExport that will appear as 'PDF/A' under Viewer Toolbar -> Export), and will hide the original PDF export option. The latter is used for Printing and its compliance level should be kept to None (the default value) to allow JavaScript.
<extensions>
<render>
<extension name="PdfExport"
type="Telerik.Reporting.ImageRendering.PdfReport, Telerik.Reporting, Version=12.2.18.1129, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
description="PDF/A">
<parameters>
<parameter name="ComplianceLevel" value="PDF/A-3b"></parameter>
</parameters>
</extension>
<extension name="PDF" visible="false"></extension>
....
</render>
</extensions>