This short guide explains how to convert DWG to DWF using C# REST API. The transformation of DWG to DWF using C# Low Code API turns your editable CAD drawing into a lightweight, shareable, read-only file for easy viewing, printing, and markup without exposing the original. You will perform his conversion with the help of a Dotnet-based Cloud SDK.
Prerequisite
- Create an account and get API credentials for converting a DWG file to DWF
- Download Aspose.Cad Cloud SDK for Dotnet to change DWG to DWF
- Set up a C# project with the above SDK
Steps to Convert DWG File to DXF using C# .NET-based API
- Create a CadApi instance with your App Key, App SID, and baseUrl
- Point inputPath to the source DWG and outputPath to the target DWF file
- Open the DWG, copy it into a MemoryStream, and reset Position to 0
- Build a PutDrawingDwfRequest with the prepared MemoryStream
- Call cadApi.PutDrawingDwf(request) to obtain the converted DWF as a stream
- Create the destination file and copy the result stream to the outputPath
These steps have summarized the process to change DWG in DWF using C# .NET-based API. First, set up CadApi with your credentials and point it to your DWG file and the DWF you want to create. Then load the DWG into memory, send it with PutDrawingDwfRequest to convert, and save the returned stream as your DWF.
Code for AutoCAD to DWF Converter using C# REST Interface
This code sample has demonstrated the process to develop a DWG to DWF converter online using C# REST API. The source file is loaded directly from the disk storage; however, you may upload multiple files into the Cloud storage and perform the transformations for the already uploaded files. You may supply optional params such as target page size/DPI, background color, rotation, zoom/scale, etc., using the extra parameters in the PutDrawingDwfRequest() method.
This tutorial has taught us the conversion of DWG to DWF. To transform a DWG file to DXF, refer to the article on Convert DWG into DXF using C# REST API.