---
title: "Converting CAD files (DWG/DXF) to PDF format | Nutrient Python SDK"
canonical_url: "https://www.nutrient.io/guides/python/conversion/cad-to-pdf/"
md_url: "https://www.nutrient.io/guides/python/conversion/cad-to-pdf.md"
last_updated: "2026-05-25T06:31:34.551Z"
description: "Convert CAD files (DWG and DXF) to PDF using Nutrient Python SDK."
---

# Converting CAD files (DWG/DXF) to PDF format

Convert CAD files (DWG and DXF) to PDF when you need to share drawings, store records, or integrate with document workflows. PDF output makes drawings accessible to people who don’t use CAD tools.

[Download sample](https://www.nutrient.io/downloads/samples/python/cad-to-pdf.zip)

## How Nutrient supports this workflow

Nutrient Python SDK converts CAD files to PDF through a single API call.

You don’t need to manage:

- CAD file parsing

- Vector rendering of technical drawings

- Layer and dimension handling

- Line weights and drawing styles

Use the SDK API to handle conversion logic in your application.

## Complete implementation

This example shows a complete CAD-to-PDF conversion flow.

Import the required Nutrient classes:

```python

from nutrient_sdk import Document
from nutrient_sdk import NutrientException

```

Open the CAD file with a Python [context manager](https://docs.python.org/3/reference/datamodel.html#context-managers). The context manager closes the document automatically:

```python

def main():
    try:
        with Document.open("input.dwg") as document:

```

Export the file to PDF and handle conversion errors with `NutrientException`:

```python

            document.export_as_pdf("output.pdf")
            print("Successfully converted to output.pdf")
    except NutrientException as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    main()

```

## Summary

The conversion flow has two steps:

1. Open the CAD file.

2. Export it as PDF.

Nutrient handles CAD parsing and PDF rendering, so you don’t need to implement format-specific conversion logic.

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

## Related pages

- [Converting email files (MSG/EML) to PDF format](/guides/python/conversion/email-to-pdf.md)
- [Handling errors in document processing workflows](/guides/python/conversion/error-handling.md)
- [Converting a document from XLSX to PDF format](/guides/python/conversion/excel-document-to-pdf.md)
- [Nutrient Python SDK conversion guides](/guides/python/conversion.md)
- [Converting a document from Markdown to PDF format](/guides/python/conversion/markdown-to-pdf.md)
- [Converting PDF documents to Excel format for data analysis](/guides/python/conversion/pdf-to-excel-document.md)
- [Converting PDF documents to HTML format for web publishing](/guides/python/conversion/pdf-to-html.md)
- [Converting PDF documents to image format](/guides/python/conversion/pdf-to-image.md)
- [Converting PDF documents to Markdown format](/guides/python/conversion/pdf-to-markdown.md)
- [Converting PDF documents to PDF/A format](/guides/python/conversion/pdf-to-pdf-a.md)
- [Converting PDF documents to PDF/UA format](/guides/python/conversion/pdf-to-pdf-ua.md)
- [Converting PDF documents to PowerPoint presentations](/guides/python/conversion/pdf-to-powerpoint-document.md)
- [Converting a document from PDF to DOCX format](/guides/python/conversion/pdf-to-word-document.md)
- [Converting a document from PPTX to PDF format](/guides/python/conversion/powerpoint-document-to-pdf.md)
- [Converting a Word document to PDF while preserving comments](/guides/python/conversion/word-document-to-pdf-including-comments.md)
- [Converting a document from DOCX to PDF/UA format](/guides/python/conversion/word-document-to-pdf-ua.md)
- [Converting a document from DOCX to PDF format](/guides/python/conversion/word-document-to-pdf.md)

