This quick tutorial shows you how to convert DWG to PSD using a Java REST API. You’ll build a DWG‑to‑PSD converter with the Java REST Interface powered by the Java‑based Cloud SDK. The sample code walks through the full workflow—from uploading the source DWG file, invoking the conversion, retrieving the PSD output, to saving it on your local disk.
Prerequisite
- Create an account and get API credentials for changing a DWG file to PSD
- Download Aspose.Cad Cloud SDK for Java to transform DWG to PSD
- Set up a Java project with the above SDK
Steps for DWG to PSD Converter using Java REST Interface
- Instantiate CadApi with your Client ID, Client Secret, and base URL so you can call the Aspose.CAD Cloud service
- Point inputPath to the DWG you want to convert and set outputPath to a .psd file where the result will be saved
- Open the source file, copy its bytes into a MemoryStream, and rewind to the start so it’s ready to send
- Wrap the in-memory stream in a PutDrawingPsdRequest to tell the service you want PSD output
- Call PutDrawingPsd on your CadApi instance to perform the cloud conversion and receive the result as a stream
- Create the destination file at outputPath, copy the result stream into it, and print a success message showing where the PSD was saved
Set up CadApi with your credentials and base URL, set your input DWG and output PSD files, then read the input file into a MemoryStream. Wrap that stream in PutDrawingPsdRequest, call PutDrawingPsd to get the converted data, and save it to outputPath.
Code for DWG to PSD Converter Online using Java RESTful Service
The sample code demonstrates how to build a DWG‑to‑PSD converter using the Java REST API. By supplying rasterization and format options in your PutDrawingPsdRequest or PutDrawingPdfRequest—instead of sending just the raw bytes—you override the defaults and gain full control over page size, DPI, background, layouts, layers, and more.
You’ve now learned how to convert DWG files to PSD using the Java REST API. If you also need to generate PDFs from DWG, see our guide on Convert DWG file to PDF using Java REST API.