I have a dwg file with multiple layers. some layers are “on” and some are “off” in dwg file. when I create the pdf file the entity in “off” layers are also visible
can you please let me know how to hide the off layers
Please, note that there is no direct way to achieve the above said functionality. However, you can export specific layer(s) in a DWG file to PDF file. In order to achieve this functionality you have to implement the following simple steps:
Open a DWG drawing file using the Image.load factory method.
Create an instance of CadRasterizationOptions and specify PageWidth & PageHeight properties.
Add layers to the object of CadRasterizationOptions.
Create an instance of PdfOptions & set its VectorRasterizationOptions property.
Export the drawing to PDF using the Image.save(, ) method.
For more information, please access the URL given below and follow the topic:
Thanks for your reply. Any autocad file will have multiple layers and can be ON or OFF. So I think pdf should be created with the saved state of the autocad file. If this is not available now, will this be in future release?
Also instead of telling what layers to show, can we define which layer should be off. This will make life easy
for attached “drawing10.dwg” file, I have some entity in “Layer1” which i do not want to show.
//Load an existing CAD in an instance of Image Image image = Image.load(sourceImage);
//Create an instance of CadRasterizationOptions and set its various properties CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);
Please, note that we have investigated the said issue at our end. We have used the latest version aspose-imaging-3.0-jdk16.jar. We tried different scenarios and found that the issue persists. Therefore, the issue has been logged into our issue tracking system with ID IMAGING-34975. Our product team will look into it and provide feedback. We will update you accordingly.