Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert CAD Drawings (DWG, DGN, DWF) to PDF
// Convert CAD drawing - DWG to PDF in C# using GroupDocs.Conversion for .NET
// Load Options
Contracts.Func<LoadOptions> getLoadOptions = () => new CadLoadOptions
{
LayoutNames = new []{ "Layout1", "Layout3" }, // Specifying Layouts
// Width = 1920,
// Height = 1080
};
using (Converter converter = new Converter("filePath/CAD-Drawing.dwg", getLoadOptions))
{
PdfConvertOptions options = new PdfConvertOptions();
converter.Convert("filePath/cadToPDF-NET.pdf", options);
}
// Convert CAD Drawing - DWG to PDF in Java using GroupDocs.Conversion for Java
// Load Options
CadLoadOptions loadOptions = new CadLoadOptions();
loadOptions.setLayoutNames(new String[]{ "Layout1"});
// PDF Options
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setGrayscale(true);
// PDF Conversion Options
PdfConvertOptions options = new PdfConvertOptions();
options.setRotate(Rotation.On90);
options.setPdfOptions(pdfOptions);
/*
options.setDpi(300);
options.setWidth(800);
options.setHeight(600);
*/
// Converter
Converter converter = new Converter("filePath/CAD-Drawing.dwg", loadOptions);
converter.convert("filePath/cadToPDF-Java.pdf", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.