|
| 1 | +--- |
| 2 | +title: Form Filling |
| 3 | +page_title: Telerik UI PDFViewer component for {{ site.framework }} Documentation - Form Filling |
| 4 | +description: "Get familiar with the Form Filling feature provided by the Telerik UI PDFViewer component for {{ site.framework }}." |
| 5 | +slug: form_filling_pdfviewer_core |
| 6 | +position: 5 |
| 7 | +--- |
| 8 | + |
| 9 | +# Form Filling |
| 10 | + |
| 11 | +Starting with Telerik UI {{ site.framework }} version Q2 2025, the PDFViewer introduces a comprehensive Form Filling feature that allows users to interact with and complete PDF forms directly within the viewer. |
| 12 | + |
| 13 | +When uploading PDF files that contain forms, users can utilize the form editors by entering data and making selections without requiring external PDF editing tools. The Form Filling feature simplifies the process of editing and managing PDF forms, enhancing user experience and productivity. |
| 14 | + |
| 15 | +> Form Filing feature is available only with [PDF.js processing]({% slug htmlhelpers_pdfviewer_pdfjs_processing_aspnetcore%}). |
| 16 | +
|
| 17 | +To activate the Form Filling feature, enable the `RenderForms` option in the `PdfjsProcessing` configuration: |
| 18 | + |
| 19 | +```HtmlHelper |
| 20 | + @(Html.Kendo().PDFViewer() |
| 21 | + .Name("pdfviewer") |
| 22 | + .PdfjsProcessing(pdf =>{ |
| 23 | + pdf.RenderForms(true); |
| 24 | + pdf.File("~/shared/web/pdfViewer/sample.pdf"); |
| 25 | + }) |
| 26 | + .Height(800) |
| 27 | + ) |
| 28 | +``` |
| 29 | +{% if site.core %} |
| 30 | +```TagHelper |
| 31 | + <kendo-pdfviewer name="pdfviewer" height="800"> |
| 32 | + <pdfjs-processing render-forms="true" file="@Url.Content("~/shared/web/pdfViewer/sample.pdf")" /> |
| 33 | + </kendo-pdfviewer> |
| 34 | +``` |
| 35 | +{% endif %} |
| 36 | + |
| 37 | +## Form Inputs |
| 38 | + |
| 39 | +The supported form input types include: |
| 40 | + |
| 41 | +- Text Box—Enables users to input and edit text within designated form fields. |
| 42 | +- Password Box—Provides secure entry of sensitive information through password-protected fields. |
| 43 | +- Combo Box—Allows users to select options from a drop-down menu within the PDF form. |
| 44 | +- Check Box—Lets users toggle between selected and deselected states for predefined options. |
| 45 | +- Radio Button—Implements radio button functionality for selecting exclusive options within a group. |
| 46 | +- Signature Field—Enables users to digitally sign PDF documents directly within the viewer. |
| 47 | +- List Box—Allows users to select multiple options from a list of predefined items. |
| 48 | + |
| 49 | +## Form Styling |
| 50 | + |
| 51 | +Currently, the [Telerik and Kendo UI themes]({% slug sassbasedthemes_overview %}) do not contain the necessary styles for the form elements rendered in the layers. For this reason, to enhance the appearance of the form elements, include the following CSS styles on the page where the PDFViewer is defined. |
| 52 | + |
| 53 | +```css |
| 54 | +<style> |
| 55 | + .k-annotation-layer .k-text-widget-annotation .k-annotation-content { |
| 56 | + position: absolute; |
| 57 | + width: 100%; |
| 58 | + height: 100%; |
| 59 | + pointer-events: none; |
| 60 | + } |
| 61 | + |
| 62 | + .k-annotation-layer { |
| 63 | + --annotation-unfocused-field-background: url(data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>); |
| 64 | + --input-focus-border-color: black; |
| 65 | + --input-focus-outline: 1px solid Canvas; |
| 66 | + --input-unfocused-border-color: transparent; |
| 67 | + --input-disabled-border-color: transparent; |
| 68 | + --input-hover-border-color: black; |
| 69 | + --link-outline: none; |
| 70 | + } |
| 71 | + |
| 72 | + .k-annotation-layer .k-text-widget-annotation > input, .k-annotation-layer .k-text-widget-annotation > textarea, .k-annotation-layer .choiceWidgetAnnotation > select, .k-annotation-layer .k-button-widget-annotation:is(.k-checkbox-widget-annotation, .k-radio-button-widget-annotation) input { |
| 73 | + height: 100%; |
| 74 | + width: 100%; |
| 75 | + } |
| 76 | + |
| 77 | + .k-annotation-content { |
| 78 | + position: absolute; |
| 79 | + width: 100%; |
| 80 | + height: 100%; |
| 81 | + pointer-events: none; |
| 82 | + } |
| 83 | + |
| 84 | + .k-annotation-layer { |
| 85 | + :is(.k-link-annotation, .k-button-widget-annotation.k-push-button-widget-annotation) > a { |
| 86 | + position: absolute; |
| 87 | + font-size: 1em; |
| 88 | + top: 0; |
| 89 | + left: 0; |
| 90 | + width: 100%; |
| 91 | + height: 100%; |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + .k-annotation-layer { |
| 96 | + :is(.k-link-annotation, .k-button-widget-annotation.k-push-button-widget-annotation):not(.hasBorder) > a:hover { |
| 97 | + opacity: 0.2; |
| 98 | + background-color: rgb(255 255 0); |
| 99 | + box-shadow: 0 2px 10px rgb(255 255 0); |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + </style> |
| 104 | +``` |
| 105 | + |
| 106 | +## See Also |
| 107 | + |
| 108 | +* [Using Form Filling in the PDFViewer for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/pdfviewer/form-filling) |
| 109 | +* [Server-Side API Reference of the PDFViewer for {{ site.framework }}](/api/pdfviewer) |
| 110 | +{% if site.core %} |
| 111 | +* [Server-Side TagHelper API Reference of the PDFViewer for {{ site.framework }}](/api/taghelpers/pdfviewer) |
| 112 | +{% endif %} |
| 113 | +* [Client-Side API Reference of the PDFViewer](https://docs.telerik.com/kendo-ui/api/javascript/ui/pdfviewer) |
| 114 | + |
0 commit comments