Hide off layers in pdf

Hello,

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

Thanks & regards,
Pranav C Lunavat


Hi Pranav,

Thank you for your inquiry.

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:

  1. Open a DWG drawing file using the Image.load factory method.
  2. Create an instance of CadRasterizationOptions and specify PageWidth & PageHeight properties.
  3. Add layers to the object of CadRasterizationOptions.
  4. Create an instance of PdfOptions & set its VectorRasterizationOptions property.
  5. Export the drawing to PDF using the Image.save(, ) method.

For more information, please access the URL given below and follow the topic:

Exporting DWG Drawings to PDF

Hope the above information helps. In case of any issues, need further clearance please be sure to let us know, we will be glad to assist you.

Hello ikram.haq,

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);

//Remove desired layers
rasterizationOptions.getLayers().remove(“Layer1”);

//Create an instance of PdfOptions
PdfOptions pdfOptions = new PdfOptions();

//Set the VectorRasterizationOptions property
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

//Export the CAD to PDF
image.save(outputImage, pdfOptions);

But the above code is still showing entity in "Layer1"

Thanks & regards,
Pranav C Lunavat
Hi Pranav,

Thank you for writing us back along with sample file.

Please, allow us some time to properly look into it. We will update you accordingly. We thank you for your patient.

Hi Pranav,

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.

We are sorry for the inconvenience caused.

Hi Pranav,

Thank you for being patient.

Please note that we are working on the issue and need more information from your side in order to further investigate the issue.

Information Needed:

1. Some more samples having same problem.
2. Software information that you used to create such files.
3. Step by step procedure that you adopted to create such files.
4. Software that you use for previewing such files.

Hope the above information helps. Feel free to contact us in case you have further query or comments.

@plunavat,

Can you please check the following request and share the requested information.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.