Installing Aspose.CAD for Python
Contents
[
Hide
]Installation of the aspose-cad package
Using pip to install a package
- To install the aspose.cad package, the sites with the package have an additional description of the command to be executed in the terminal:
- An example of a command to install a package through the terminal:
pip install aspose-cad
Using WHL file to install a package
To download the whl file, go to the pypi page of the aspose.cad package and download the file
To install the aspose.cad package, you need to use the pip command with the full path to the whl file:
pip install C:\Users\User\Desktop\aspose_cad-23.6-py3-none-win_amd64.whl
After the installation, we will see the package in the site-package folder
Example code
Example code for converting a file
import aspose.cad as cad
if __name__ == '__main__':
image = cad.Image.load("drawing.dxf")
rasterizationOptions = cad.imageoptions.CadRasterizationOptions()
rasterizationOptions.page_height = 1200.0
rasterizationOptions.page_width = 1200.0
pdfOptions = cad.imageoptions.PdfOptions()
pdfOptions.vector_rasterization_options = rasterizationOptions
image.save("output.pdf", pdfOptions)