Nutrient MAUI SDK enables you to convert images to PDFs. For more information on the supported image formats, see the list of supported file types.

Image to PDF

To generate a PDF using images, follow the steps below.

  1. 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());
  2. Optionally, make changes to the image. For example, add an annotation.

  3. 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.

  1. Save the output. The export method returns a byte array, which can be saved to a file or sent to a server.