Fills the PDF form document.
public void FillFormFields(
IList<PDFFormField> fields,
string destinationFileName
)
public:
void FillFormFields(
IList<PDFFormField^>^ fields,
String^ destinationFileName
)
def FillFormFields(self,fields,destinationFileName):
fields
A List of PDFFormField to fill. This must not be null and a list of 1 or more items. An empty list (count is zero) will throw an exception.
destinationFileName
Name of the destination PDF document to be created. If the value of this parameter is null, then the filename set in FileName will be updated.
You can use FillFormFields to fill PDF form documents.
LEADTOOLS supports loading all form fields from a PDF file. Due to the nature and complexity of PDF form fields, especially the prevalent use of PDF files that contain many custom and user-defined fields, LEADTOOLS reads the data as is and sets it in PDFFormField without any modification. Refer to the PDF Form Fields Demo for an example of parsing data to generate a live, editable PDF file.
using Leadtools.WinForms;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.Pdf;
using Leadtools.Svg;
public void PDFFillFormFieldsExample(string fileName, string name, string value, int type)
{
PDFFile file = new PDFFile(fileName);
IList<PDFFormField> fields = new List<PDFFormField>();
PDFFormField field = new PDFFormField();
field.Name = name;
field.Contents = new List<String>();
field.Contents.Add(value);
field.ContentType = type;
fields.Add(field);
file.FillFormFields(fields, null);
}
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Scanner;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.pdf.*;
public void pdfFileFillFormFieldsExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
String fileName = combine(LEAD_VARS_IMAGES_DIR, "InteractiveForm.pdf");
String name = "leadtools";
String value = "value";
int type = 0;
PDFFile file = new PDFFile(fileName);
ArrayList<PDFFormField> fields = new ArrayList<PDFFormField>();
PDFFormField field = new PDFFormField();
field.setName(name);
field.getContents().add(value);
field.setContentType(type);
fields.add(field);
file.fillFormFields(fields, null);
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document