---
title: "Converting CAD files to PDF | Nutrient Java SDK"
canonical_url: "https://www.nutrient.io/guides/java/conversion/cad-to-pdf/"
md_url: "https://www.nutrient.io/guides/java/conversion/cad-to-pdf.md"
last_updated: "2026-06-09T21:11:56.021Z"
description: "Convert CAD files to PDF documents using Nutrient Java SDK."
---

# Converting CAD files to PDF

Convert CAD files to PDF when you need to share technical drawings with teams that don’t use CAD software.

Teams often convert DWG and DXF files to PDF for:

- Design review

- Document management workflows

- External stakeholder sharing

## Convert CAD files to PDF with the Java SDK

Nutrient Java SDK provides CAD-to-PDF conversion through the `Document` API.

You don’t need to build:

- CAD parsing logic

- Custom rendering pipelines

- Layout-preservation code for technical drawings

## Prepare the project

Define a package and class:

```java

package io.nutrient.Sample;

```

Import the required SDK classes:

```java

import io.nutrient.sdk.Document;
import io.nutrient.sdk.exceptions.NutrientException;

public class CADToPDF {

```

Create `main` and declare `NutrientException`:

```java

    public static void main(String[] args) throws NutrientException {

```

## Open the CAD file

Use `Document.open(...)` inside a [try-with-resources statement](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) so Java closes the document automatically:

```java

        try (Document document = Document.open("input.dwg")) {

```

Use an absolute path or a path relative to your working directory. The SDK supports DWG and DXF input.

## Export as PDF

Call `exportAsPdf(...)` to create the output file:

```java

            document.exportAsPdf("output.pdf");
        }
    }
}

```

## Handle errors

Nutrient Java SDK raises `NutrientException` when an operation fails. You can declare it in the method signature, as shown above, or catch it with `try`/`catch` for custom handling.

## Summary

The conversion flow has two steps:

1. Open the CAD file.

2. Export it as PDF.

Download [this sample package](https://www.nutrient.io/downloads/samples/java/cad-to-pdf.zip) to run the example locally.
---

## Related pages

- [Converting HTML to PDF](/guides/java/conversion/html-to-pdf.md)
- [Converting PDF documents to Excel format for data analysis](/guides/java/conversion/pdf-to-excel-document.md)
- [Nutrient Java SDK conversion guides](/guides/java/conversion.md)
- [Converting a document from XLSX to PDF format](/guides/java/conversion/excel-document-to-pdf.md)
- [Converting email files to PDF](/guides/java/conversion/email-to-pdf.md)
- [Converting PDF documents to HTML format for web publishing](/guides/java/conversion/pdf-to-html.md)
- [Converting PDF documents to PDF/A format](/guides/java/conversion/pdf-to-pdf-a.md)
- [Converting a document from Markdown to PDF format](/guides/java/conversion/markdown-to-pdf.md)
- [Converting PDF documents to image format](/guides/java/conversion/pdf-to-image.md)
- [Converting PDF documents to PDF/UA format](/guides/java/conversion/pdf-to-pdf-ua.md)
- [Converting PDF documents to Markdown format](/guides/java/conversion/pdf-to-markdown.md)
- [Converting a document from PPTX to PDF format](/guides/java/conversion/powerpoint-document-to-pdf.md)
- [Converting a document from PDF to DOCX format](/guides/java/conversion/pdf-to-word-document.md)
- [Converting a document from DOCX to PDF format](/guides/java/conversion/word-document-to-pdf.md)
- [Converting a document from DOCX to PDF/UA format](/guides/java/conversion/word-document-to-pdf-ua.md)
- [Converting PDF documents to PowerPoint presentations](/guides/java/conversion/pdf-to-powerpoint-document.md)
- [Converting a Word document to PDF while preserving comments](/guides/java/conversion/word-document-to-pdf-including-comments.md)

