|
| 1 | +--- |
| 2 | +title: Configuring RadClientExportManager for PDF Export in ASP.NET AJAX |
| 3 | +description: Learn how to set up and customize the PDF export options of RadClientExportManager, including landscape mode, paper size, and fitting content on the page. |
| 4 | +type: how-to |
| 5 | +page_title: How to Customize PDF Export Settings in RadClientExportManager for ASP.NET AJAX |
| 6 | +slug: customize-pdf-export-radclientexportmanager-aspnet-ajax |
| 7 | +tags: radclientexportmanager, asp.net ajax, pdf export, landscape, papersize, scale |
| 8 | +res_type: kb |
| 9 | +ticketid: 1683015 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +<table> |
| 15 | +<tbody> |
| 16 | +<tr> |
| 17 | +<td>Product</td> |
| 18 | +<td>RadClientExportManager for ASP.NET AJAX</td> |
| 19 | +</tr> |
| 20 | +<tr> |
| 21 | +<td>Version</td> |
| 22 | +<td>2025.1.218</td> |
| 23 | +</tr> |
| 24 | +</tbody> |
| 25 | +</table> |
| 26 | + |
| 27 | +## Description |
| 28 | + |
| 29 | +When exporting content to PDF using RadClientExportManager, I need detailed information on all available pdfSettings properties and their acceptable values. Specifically, I'm looking for guidance on setting the landscape mode correctly, using different paper sizes like "Letter", and ensuring content such as charts fits on the page without unnecessary trial and error. This knowledge base article also answers the following questions: |
| 30 | + |
| 31 | +- How to configure landscape or portrait mode in PDF export? |
| 32 | +- What are the acceptable paper sizes for PDF export? |
| 33 | +- How can I ensure my content fits within the page when exporting to PDF? |
| 34 | + |
| 35 | +## Solution |
| 36 | + |
| 37 | +To customize the PDF export settings in RadClientExportManager, follow these guidelines: |
| 38 | + |
| 39 | +1. **Landscape Property**: This accepts a boolean value. Use `true` for landscape and `false` for portrait orientation. |
| 40 | + ```javascript |
| 41 | + landscape: false, // Portrait |
| 42 | + landscape: true, // Landscape |
| 43 | + ``` |
| 44 | + |
| 45 | +2. **PaperSize Values**: Common paper sizes like "A4", "Letter", and "Legal" are supported. You can also specify custom sizes using an array of width and height in points (1 pt = 1/72 inch), for example, `[800, 600]`. |
| 46 | + |
| 47 | +3. **Full List of Export Settings**: RadClientExportManager leverages the Kendo UI Drawing API for PDF export. Refer to the [Kendo UI PDF Export Documentation](https://docs.telerik.com/kendo-ui/framework/pdf/overview) for a comprehensive list of options. |
| 48 | + |
| 49 | +4. **Shrink to Fit**: Adjust the `scale` and `margin` properties to fit content on the page. Ensure the content width does not exceed the paper size. Example settings for a "Letter" paper size with adjusted scale and margins: |
| 50 | + ```javascript |
| 51 | + var pdfSettings = { |
| 52 | + fileName: "Full-PDF-Export", |
| 53 | + proxyURL: "http://www.proxy.com", |
| 54 | + margin: { top: "20mm", left: "10mm", bottom: "20mm", right: "10mm" }, |
| 55 | + paperSize: "Letter", |
| 56 | + landscape: false, // Change as needed |
| 57 | + scale: 0.8, // Adjust scale to fit content |
| 58 | + // Additional properties... |
| 59 | + }; |
| 60 | + ``` |
| 61 | + |
| 62 | +### Example Implementation |
| 63 | +```javascript |
| 64 | +function exportPDF() { |
| 65 | + var exportManager = $find('<%=RadClientExportManager1.ClientID%>'); |
| 66 | + var pdfSettings = { |
| 67 | + fileName: "Full-PDF-Export", |
| 68 | + proxyURL: "http://www.proxy.com", |
| 69 | + // Configure other pdfSettings properties as shown above |
| 70 | + }; |
| 71 | + exportManager.set_pdfSettings(pdfSettings); |
| 72 | + exportManager.exportPDF($(".MyGrid")); |
| 73 | +} |
| 74 | +``` |
| 75 | + |
| 76 | +Add a RadClientExportManager to your page: |
| 77 | +```aspx |
| 78 | +<telerik:RadClientExportManager runat="server" ID="RadClientExportManager1"></telerik:RadClientExportManager> |
| 79 | +``` |
| 80 | + |
| 81 | +For RadGrid or other Telerik UI for ASP.NET AJAX controls, configure them as needed and use the `exportPDF` JavaScript function to initiate the export. |
| 82 | + |
| 83 | +## See Also |
| 84 | + |
| 85 | +- [RadClientExportManager Overview](https://www.telerik.com/products/aspnet-ajax/documentation/controls/clientexportmanager/overview) |
| 86 | +- [Kendo UI PDF Export Documentation](https://docs.telerik.com/kendo-ui/framework/pdf/overview) |
| 87 | +- [Kendo UI Drawing API Documentation](https://docs.telerik.com/kendo-ui/api/javascript/drawing) |
0 commit comments