DWG to PDF API
Send a DWG file to POST /v2/convert/dwg/to/pdf and a vector PDF of the drawing's model space comes back. A CAD renderer opens the drawing and plots it, and each visible layer becomes a PDF layer.
- Endpoint
- POST /v2/
convert/ dwg/ to/ pdf - Accepts
- dwg
- Sample timing
- 23 ms median of 5 runsHow we measure
- Request size
- Up to 10 MB on the Free plan or 100 MB on paid plans, all files together
Request and response
Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.
curl -sS -X POST \
https://api.pdfconversionapi.com/v2/convert/dwg/to/pdf \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@suite-210-plan.dwg \
-o response.json
# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
mkdir -p converted
name=$(jq -r '.Files[0].FileName' response.json)
jq -r '.Files[0].FileData' response.json \
| base64 --decode > "converted/$name"
else
cat response.json
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/dwg/to/pdf",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("suite-210-plan.dwg", "rb"))],
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "suite-210-plan.dwg";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/dwg/to/pdf";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"ConversionCost": 1,
"ConversionTime": 0.023,
"Files": [
{
"FileName": "suite-210-plan.pdf",
"FileExt": "pdf",
"FileSize": 14436,
"FileData": "JVBERi0xLjcKJYCAgIAKMSAw…"
}
]
}Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.
The sample, converted
The same file the code sends. Download the input and the output and compare them yourself.

- Input
- suite-210-plan.dwg (12 KB)
- Output
- suite-210-plan.pdf (14 KB)
- Source
- Drawn for this site (fictional project); saved as DWG by this API (CC0-1.0). How it was made
- Made by
- 2026-11-04, API build
9eeeb0640aba
Parameters
Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.
| Parameter | What it does |
|---|---|
FileNamestring | Name for the PDF, without the extension. Without it the PDF takes the uploaded drawing's name. |
StoreFileboolean, default false | Return a download link instead of the file. The link expires after 3 hours and the file is then deleted. |
Not supported yet
Setting one of these to anything but its default returns 400.
| Option | What to do instead |
|---|---|
SpaceToConvert | The PDF always shows model space, and only the default value is accepted: even SpaceToConvert=model returns 400, so leave it out. Paper-space layouts aren't plotted yet. |
CustomSpaceToConvert | A layout can't be picked by name yet, for the same reason. |
PageSize | The sheet always lies sideways: US Letter (11 x 8.5 in), or A4 when the drawing's MEASUREMENT setting is metric. For another sheet size, send the PDF to /v2/convert/pdf/to/resize. |
PageOrientation | The page is always wider than it is tall. The documented default, portrait, is accepted, but the page doesn't turn. |
PageWidth, PageHeight | Use PageSize=custom on /v2/convert/pdf/to/resize after converting. |
AutoFit | The drawing is always scaled to fit the page. |
ExportLayers | Visible layers always become PDF layers; false returns 400. |
ColorSpace | Lines keep their layer colors. Only the default, truecolors, is accepted; grayscale and monochrome output aren't available yet. |
What carries over, and what doesn't
Kept
- Lines, polylines, text and solid fills as vector paths; the sample PDF has no images in it
- Every visible layer as a named PDF layer; the file asks the viewer to open its Layers panel
- Layer colors, with white (color 7) printed as black
- Linetypes from the drawing, such as the dashed ceiling grid in the sample's conference room
- Layers that are off or frozen stay hidden: they are left out of the PDF
Lost or not yet supported
- Text becomes outlines drawn with lines, so the PDF has no text to select, search or copy. The sample has 26 text entities, and
/v2/convert/pdf/to/txtreturns an empty file for its PDF. - Circles and arcs are written as chains of short straight segments, not curves. At page size they look round; zoomed in, the conference chairs in the sample show their corners.
- Screen colors are kept. Yellow and cyan, common on annotation layers, are pale on a white page: look at the room names in the sample.
- Only model space is plotted. Paper-space layouts, their viewports and their page setups are ignored, so a title block drawn in a layout is missing.
- There is no true scale. Whatever its size or units, the drawing is fitted to one sideways sheet with 0.25 in margins: Letter, or A4 for a drawing set to metric measurement.
- 3D solids, regions, lights, OLE objects and raster images aren't drawn. In our test set of 14 DWG files, 12 drew all their 2D content, one made only of 3D solids came out blank, and one showed empty frames in place of 5 raster images.
- Text set in SHX fonts is drawn with the renderer's built-in single-stroke font, so lettering can look different from the original.
Limits
- DWG files saved in the R13 through 2018 formats. Older DWG versions are not supported.
- One PDF page per drawing.
- A DWG that is cut short returns 422 "the input file could not be read: DWG: the file is cut short or damaged".
- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- A conversion can run for up to 120 seconds; after that the API returns 504.
Where teams use it
Previews of uploaded drawings
Browsers can't open DWG. Convert each upload once and show the PDF in your project portal, where viewers that support PDF layers let people hide furniture or dimensions.
Drawings for people without CAD software
Owners, permit reviewers and subcontractors often need to look at a plan, not edit it. Send them the PDF instead of asking them to install a DWG viewer.
A PDF next to every revision
When a new DWG revision is checked in, convert it and store the PDF beside it, so anyone can compare revision B with revision C without opening a CAD program.
Questions
Which DWG versions can it open?
Files saved in the R13 through 2018 formats. In our test set, files saved as R13, R14, 2000, 2004, 2007, 2010, 2013 and 2018 all opened and drew the same.
Can I plot a paper-space layout instead of model space?
Not yet. The API plots model space only, fitted to the page. SpaceToConvert and CustomSpaceToConvert return 400 for any value other than the default, so leave them out. If your title block and viewports live in a layout, they won't be in the PDF.
How do I get the drawing on a 24 x 36 in or A3 sheet?
Convert first, then send the PDF to /v2/convert/pdf/to/resize. Use PageSize=a3, or PageSize=custom with PageWidth=36, PageHeight=24 and MeasurementUnit=in for a 36 x 24 in sheet. The drawing is scaled up with the page.
Why are some labels hard to read?
The PDF uses each layer's display color. Yellow (color 2) and cyan (color 4) read well on a dark CAD screen and poorly on paper. There's no monochrome option yet: ColorSpace=grayscale or monochrome returns 400. Changing the layer color in the drawing is the fix for now.
Can people turn layers on and off in the PDF?
Yes, in viewers that support PDF layers. Each visible layer keeps its name, so the sample's PDF has A-WALL, A-DOOR, A-FURN, A-ANNO-DIMS and the rest as separate layers you can hide.
Convert your first DWG file in a minute.