Free Support Forum -

Get model area & font rendering

I’m trying out Aspose.CAD to convert some DWG files to PDF.

The DWG files have only a model view and no layouts, so I want to convert only the area where are lines and not the empty space around. Is there a function to get the area with lines without the “white space” around and get the dimensions of it?

After the first test I’ve also the problem, that the font of the PDF differs from the DWG. The font in the DWG is “W3-5”, I think thats a default AutoCAD font.
Is there a way to get the font rendered like in AutoCAD?

Thanks in advance.

I use version 17.04.


I have observed your requirements and request you to please share the source DWG file along with used sample code and desired output PDF. We will investigate the requirement further on our end to help you out.

thanks for the reply, I’ve uploaded some test data, so please take a look. (205.5 KB)

I need to get the purple square of the drawing with dimensions to select the right PDF paper size.
And the font is a problem, some characters are missing, e.g. the Ø sign and the font changed compared to the source file.

Thanks for the help


I have observed your requirements. An issue with ID CADNET-409 has been created in our issue tracking system to further investigate the possibility of your requirements to help you out . This thread has been linked with the issue so that you may be automatically notified once the detailed investigation is complete. I request for your patience until issue is investigated and further feedback is shared by our product team.


I have shared sample code with you. This will help you to achieve your requirements. The image height and width you can get from cadImage.Height and cadImage.Width. Then use it in below code snippet.

rasterizationOptions.PageHeight = height;
rasterizationOptions.PageWidth = width;

public void CADNET_409()
string outPath = “C:\dwg\409\test.pdf”;
using (CadImage cadImage = (CadImage)Image.Load(“C:\dwg\409\test.dwg”))
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();

           var height =  cadImage.Height; 
           var width =  cadImage.Width; 

           rasterizationOptions.UnitType = UnitType.Meter; 
           rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor; 
           rasterizationOptions.PageHeight = height; 
           rasterizationOptions.PageWidth = width; 
           PdfOptions pdfOptions = new PdfOptions(); 
           pdfOptions.VectorRasterizationOptions = rasterizationOptions; 
           cadImage.Save(outPath, pdfOptions); 

The issues you have found earlier (filed as CADNET-409) have been fixed in this update.