Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active March 16, 2022 08:18
Show Gist options
  • Save aspose-com-gists/798e87ec5644ab94972f766bd61fdd79 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/798e87ec5644ab94972f766bd61fdd79 to your computer and use it in GitHub Desktop.
Convert DWF to PNG or JPG JPEG Image Programmatically in C# .NET
string inputFile = "blocks_and_tables.dwf";
using (Image image = Image.Load(inputFile))
{
// Initialize JpegOptions class object
JpegOptions jpgOptions = new JpegOptions();
CadRasterizationOptions dwfRasterizationOptions = new CadRasterizationOptions();
jpgOptions.VectorRasterizationOptions = dwfRasterizationOptions;
dwfRasterizationOptions.PageHeight = 500;
dwfRasterizationOptions.PageWidth = 500;
// Export DWF to JPG image
string outPath = "blocks_and_tables.jpg";
image.Save(outPath, jpgOptions);
}
string inputFile = "blocks_and_tables.dwf";
// Load the input DWF file
using (Image image = Image.Load(inputFile))
{
// Initialize PngOptions class object
PngOptions pngOptions = new PngOptions();
CadRasterizationOptions dwfRasterizationOptions = new CadRasterizationOptions();
pngOptions.VectorRasterizationOptions = dwfRasterizationOptions;
dwfRasterizationOptions.PageHeight = 500;
dwfRasterizationOptions.PageWidth = 500;
// Export DWF to PNG image
string outPath = "blocks_and_tables.png";
image.Save(outPath, pngOptions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment