MAUI PDF generation library
Nutrient MAUI SDK is a library for generating PDF documents in an app without using a server. Newly created PDFs can be rendered in our viewer for signing, editing, form filling, and more.
Generating a PDF with a PDF form
The following sections outline how to generate a PDF using a PDF form.
Filling PDF form fields programmatically
Nutrient’s MAUI PDF library offers multiple options for filling form fields programmatically using the exposed JavaScript APIs, each with a different set of tradeoffs.
-
XFDF — For exporting to or importing from other readers.
-
Instant JSON — For the most efficient way to export or import changes made.
These APIs will be translated to native APIs in subsequent releases, so stay tuned for updates.
For more information on filling PDF form fields programmatically using JavaScript APIs, refer to our form filling guide.
Flattening form fields
The process of flattening form fields consists of rendering them over the background of a page with their current value and removing their data from the document.
For more information on flattening form fields, refer to our flattening guide.
Generating a PDF with images
To generate a PDF using images, follow the steps below.
-
While loading a document, you can pass an asset path, a local path, a URL, a byte array, or a Base64 string of an image into the loading function:
var documentFromAsset = await PSPDFKitController.LoadDocumentFromAssetsAsync(imageAssetPath, PSPDFKitController.CreateViewerConfiguration()); var documentFromLocalStorage = await PSPDFKitController.LoadDocument(imagePath, PSPDFKitController.CreateViewerConfiguration()); var documentFromBuffer = await PSPDFKitController.LoadDocumentFromBufferAsync(imageBuffer, PSPDFKitController.CreateViewerConfiguration()); var documentFromBase64String = await PSPDFKitController.LoadDocumentFromBase64StringAsync(imageAsBase64String, PSPDFKitController.CreateViewerConfiguration()); var documentFromRemoteUrl = await PSPDFKitController.LoadDocumentFromURLAsync(remoteImageURL, PSPDFKitController.CreateViewerConfiguration());
-
Optionally, make changes to the image. For example, add an annotation.
-
To export a loaded image as a PDF, use the
ExportDocumentAsync
function:
var exportConfiguration = _document.CreateExportConfiguration(); var exportedDocumentAsPDF = await _document.ExportDocumentAsync(exportConfiguration);
When exporting a document, you have several options. Refer to our export configuration guide for more details.
-
Save the output. The export method returns a byte array, which can be saved to a file or sent to a server.