---
title: "Image-to-PDF JavaScript library: JPG, PNG, TIFF to PDF | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/conversion/image-to-pdf/"
md_url: "https://www.nutrient.io/guides/web/conversion/image-to-pdf.md"
last_updated: "2026-06-09T10:31:08.656Z"
description: "Nutrient Web SDK enables you to convert image documents to PDF client-side, without the need for server-side processing."
---

# Convert images to PDFs using JavaScript

Nutrient Web SDK enables you to convert image documents to PDF client-side, without the need for server-side processing. For more information on the supported image formats, see the [list of supported file types](https://www.nutrient.io/guides/web/about/file-type-support.md).

[Try for free](https://www.nutrient.io/sdk/web/getting-started.md)

[Launch demo](https://www.nutrient.io/demo/convert-image-to-pdf)

To convert an image to a PDF using JavaScript, follow these steps:

1. [Load the source image](https://www.nutrient.io/guides/web/open-a-document.md). Optional: To load the image without a visual interface visible to the user, use the `headless` parameter.

2. Optional: Make changes to the image. For example, [add annotations](https://www.nutrient.io/guides/web/annotations/create-edit-and-remove/create.md).

3. Convert the source document to a PDF with the `exportPDF` method. Optional: Use the `outputFormat` flag to create a PDF/A document. For more information, see [Converting PDF to PDF/A](https://www.nutrient.io/guides/web/conversion/to-pdfa.md).

4. Save the output document. The `exportPDF` method returns a `Promise` that resolves to an `ArrayBuffer` that contains the output PDF document. You can use the resulting `ArrayBuffer` to download or persist the output PDF in storage. For more information on downloading or persisting the exported `ArrayBuffer`, see the [guides on saving a document](https://www.nutrient.io/guides/web/save-a-document.md).

The example below loads an image and exports it to a PDF:

```js

NutrientViewer.load({
  container: "#pspdfkit",

  document: "source.png",
  licenseKey: "YOUR_LICENSE_KEY"
}).then((instance) => {
  instance.exportPDF();
});

```

The example below loads a PNG image in headless mode, exports it to a PDF with conformance level PDF/A-4f, and downloads it in the client’s browser:

```js

NutrientViewer.load({
  container: "#pspdfkit",

  document: "source.png",
  licenseKey: "YOUR_LICENSE_KEY",
  headless: true
}).then((instance) =>
    instance.exportPDF({
      outputFormat: {
        conformance: NutrientViewer.Conformance.PDFA_4F
      }
    })
  ).then(function (buffer) {
    const blob = new Blob([buffer], { type: "application/pdf" });
    const objectUrl = window.URL.createObjectURL(blob);
    downloadPdf(objectUrl);
    window.URL.revokeObjectURL(objectUrl);
  });
function downloadPdf(blob) {
  const a = document.createElement("a");
  a.href = blob;
  a.style.display = "none";
  a.download = "output.pdf";
  a.setAttribute("download", "output.pdf");
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
}

```

When exporting a document, you have several options. Refer to our guides on [flattening annotations](https://www.nutrient.io/guides/web/annotations/flatten.md) and [incremental saving](https://www.nutrient.io/guides/web/features/document-processing.md) for more details.

Auto saving can be configured for different scenarios and use cases. You can find more information in our [auto save](https://www.nutrient.io/guides/web/features/saving.md) guide.





## FAQ

#### How do I convert images to PDF using Nutrient Web SDK?

To convert images to PDF, use Nutrient’s conversion API, where you can upload images, configure conversion settings, and generate a PDF document with the desired output format and quality.

#### What image formats are supported by Nutrient for conversion to PDF?

Nutrient supports popular image formats such as JPEG, PNG, and TIFF, allowing for a wide range of image types to be converted into PDF documents seamlessly.

#### Can I customize the PDF layout when converting images using Nutrient?

Yes, you can customize the PDF layout by specifying page sizes, margins, and image placement options in the conversion settings to create a tailored PDF document.

#### What are the benefits of converting images to PDF?

Converting images to PDF allows for better document management, easier sharing, and improved print quality, while preserving the original image content in a standardized format.

#### What are the common issues in image-to-PDF conversion with Nutrient?

Common issues include handling large image files, maintaining image quality, and ensuring correct orientation. Optimize images before conversion and adjust Nutrient settings to address these challenges.
---

## Related pages

- [Headless file conversion](/guides/web/conversion/headless.md)
- [JavaScript PDF conversion library](/guides/web/conversion.md)
- [Convert scanned PDFs to searchable PDFs using JavaScript](/guides/web/conversion/scan-to-searchable-pdf.md)
- [Convert PDFs to images using JavaScript](/guides/web/conversion/pdf-to-image.md)
- [Convert Office to PDF using JavaScript](/guides/web/conversion/office-to-pdf.md)
- [Convert PDF to Office using JavaScript](/guides/web/conversion/pdf-to-office.md)
- [Convert text to PDF using JavaScript](/guides/web/conversion/text-to-pdf.md)
- [Convert PDFs and images to PDF/A using JavaScript](/guides/web/conversion/to-pdfa.md)
- [Convert images to text using JavaScript](/guides/web/conversion/image-to-text.md)

