Last active
February 8, 2022 12:30
-
-
Save GroupDocsGists/f1e0ef5d80ba4f8bb44aa96085fb932b to your computer and use it in GitHub Desktop.
Convert CAD Drawings (DWG, DGN, DWF) to PDF in Java or .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert CAD drawing - DWF to PDF in C# using GroupDocs.Conversion for .NET | |
// Loading 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.dwf", getLoadOptions)) | |
{ | |
PdfConvertOptions options = new PdfConvertOptions(); | |
converter.Convert("filePath/cadToPDF-NET.pdf", options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert CAD Drawing - DWG to PDF in Java | |
// CAD File Loading Options | |
CadLoadOptions loadOptions = new CadLoadOptions(); | |
loadOptions.setLayoutNames(new String[]{ "Layout1"}); | |
// PDF Conversion Options | |
PdfOptions pdfOptions = new PdfOptions(); | |
pdfOptions.setGrayscale(true); | |
PdfConvertOptions options = new PdfConvertOptions(); | |
options.setRotate(Rotation.On90); | |
options.setPdfOptions(pdfOptions); | |
/* | |
options.setDpi(300); | |
options.setWidth(800); | |
options.setHeight(600); | |
*/ | |
// Conversion | |
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