Some test text!
Web / Guides / Import/export
All form data, including field values and widget appearances, can be saved and loaded the same way as annotations through XFDF data. Please see our guides on XFDF and importing/exporting annotations to learn more.
// Importing XFDF into WebViewer ...
const formXML = ``;
await instance.Core.annotationManager.importAnnotations(formXML);
// Exporting XFDF from WebViewer. Copies to browser clipboard.
copy(await instance.Core.annotationManager.exportAnnotations());
A full sample of form fields in XML format is shown below, and can be copied into the sample code above allowing it to be loaded into WebViewer with annotationManager.importAnnotations.
<?xml version="1.0" encoding="UTF-8" ?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<pdf-info xmlns="http://www.pdftron.com/pdfinfo" version="2" import-version="4">
<ffield type="Sig" name="SignatureFormField 1" />
<ffield type="Tx" name="TextFormField 2">
<font name="Helvetica" size="12" />
</ffield>
<ffield type="Btn" name="CheckBoxFormField 3">
<font name="Helvetica" />
</ffield>
<ffield type="Ch" name="ListBoxFormField 5" flags="MultiSelect">
<font name="Helvetica" size="12" />
<options>
<option display-value="Option 1" value="1" />
<option display-value="Option 2" value="2" />
<option display-value="Option 3" value="3" />
</options>
</ffield>
<ffield type="Ch" name="ComboBoxFormField 6" flags="Combo MultiSelect">
<font name="Helvetica" size="12" />
<options>
<option display-value="Test 1" value="1" />
<option display-value="Test 2" value="2" />
<option display-value="Test 3" value="3" />
</options>
</ffield>
<ffield type="Btn" name="Radio Button 1" flags="Radio NoToggleToOff">
<font name="Helvetica" />
</ffield>
<widget field="SignatureFormField 1" name="f4ee4886-b110-ca41-bc36-a6186664b7ec" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="57.22" x2="237.22" y1="701.65" y2="741.65" />
<border style="solid" />
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false","trn-signature-type":"fullSignature"}' />
</widget>
<widget field="TextFormField 2" name="1fb708d5-45ef-5c72-673d-08472833c3e6" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="57.22" x2="257.22" y1="640.886" y2="680.886" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
<widget appearance="Off" field="CheckBoxFormField 3" name="b36c2151-5b30-63a1-c5fb-2712921e9cd0" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="57.22" x2="77.22" y1="600.122" y2="620.122" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<appearances>
<aappearance name="Off" />
<aappearance name="Yes" />
</appearances>
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
<widget appearance="Off" index="1" field="Radio Button 1" name="794ab785-de71-e2f5-d2d0-6d2bdf313d5a" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="57.22" x2="77.22" y1="559.358" y2="579.358" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<appearances>
<aappearance name="Off" />
<aappearance name="794ab785-de71-e2f5-d2d0-6d2bdf313d5a" />
</appearances>
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
<widget appearance="Off" field="ListBoxFormField 5" name="894fd363-660d-2da4-6d70-684e5d79f80a" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="57.22" x2="207.22" y1="388.594" y2="538.594" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<appearances>
<aappearance name="Off" />
<aappearance name="Yes" />
</appearances>
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
<widget field="ComboBoxFormField 6" name="b67d86cb-6d31-dda3-6191-975360cc3ed6" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="57.22" x2="257.22" y1="327.83" y2="367.83" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
<widget appearance="Off" field="Radio Button 1" name="6cf0280b-9f11-6bbd-5edf-0add532c1e6b" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="90.22" x2="110.22" y1="558.8935" y2="578.8935" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<appearances>
<aappearance name="Off" />
<aappearance name="6cf0280b-9f11-6bbd-5edf-0add532c1e6b" />
</appearances>
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
<widget appearance="Off" index="2" field="Radio Button 1" name="b55fff84-8283-493c-9569-a6f2017a2b80" modified-date="D:20241022102259-07'00'" page="1">
<rect x1="123.22" x2="143.22" y1="558.429" y2="578.429" />
<border style="solid" />
<background-color r="255" g="255" b="255" />
<appearances>
<aappearance name="Off" />
<aappearance name="b55fff84-8283-493c-9569-a6f2017a2b80" />
</appearances>
<trn-custom-data bytes='{"trn-form-field-show-indicator":"false"}' />
</widget>
</pdf-info>
<fields>
<field name="SignatureFormField 1">
<value></value>
</field>
<field name="TextFormField 2">
<value>Test</value>
</field>
<field name="CheckBoxFormField 3">
<value>Off</value>
</field>
<field name="ListBoxFormField 5">
<value>3</value>
</field>
<field name="ComboBoxFormField 6">
<value></value>
</field>
<field name="Radio Button 1">
<value></value>
</field>
</fields>
<annots />
<pages>
<defmtx matrix="1,0,0,-1,0,792" />
</pages>
</xfdf>
A short introduction to XFDF file format
An introduction to XFDF file format
Importing and exporting annotations
To import and export annotation and forms data through XFDF data.
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales