We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need Text finder and convert to PDF file for .DWG files

Hi,


need .net code which find text present in .dwg files
later converts the specific layout of .dwg file to PDF?
Hi,

Thank you for your inquiry.

It is not possible to search a text in layout of DWG file. However you can convert the DWG file or specific layout of DWG file to PDF using Aspose.Imaging API. Please visit the following links for details on converting DWG to PDF:


We have created a feature request in our system with ID CADNET-112 for searching text in DWG file. Our product team will look into it. We will update you with the progress via this forum thread. It is requested to please share any sample DWG file that contains text and the text that you want to search in the file.

I want to find Title block text inside .dwg file .



Hi,

Thank you for sharing sample with us.

We have noted the information. We will use the sample shared by you. We will update you with the progress via this forum thread.

Hi,


Please use the following code snippet to search the text inside DWG file at your end and feel free to contact us in case you have any query or comments.

CODE:


using (CadImage cadImage = (CadImage)Aspose.Imaging.Image.Load(@“sample_in.dwg”))
{
// search for text in the file
foreach (Aspose.Imaging.FileFormats.Cad.CadObjects.CadBaseEntity entity in cadImage.Entities)
{
// please, note: we iterate through CadText entities here, but some other entities
// may contain text also, e.g. CadMText and others
if (entity.GetType() == typeof(Aspose.Imaging.FileFormats.Cad.CadObjects.CadText))
{
Aspose.Imaging.FileFormats.Cad.CadObjects.CadText text = (Aspose.Imaging.FileFormats.Cad.CadObjects.CadText)entity;
System.Console.WriteLine(text.DefaultValue);
}
}


// export to pdf
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.PageWidth = 1600;
rasterizationOptions.PageHeight = 1600;
rasterizationOptions.AutomaticLayoutsScaling = true;
rasterizationOptions.CenterDrawing = true;
rasterizationOptions.Layouts = new[] { “Layout1” };

PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = rasterizationOptions;

cadImage.Save(“dwg_out.pdf”, pdfOptions);
}

But i only want title block Text…

Hi,

This is to update you that our product team is working on the feature request. We will update you with the progress via this forum thread.

Furthermore please provide us the text that you are trying to search in this file and is a Title Block Text. Please provide us information about the software that you used for this file because when we try to open this file it says: This DWG file was saved by an application that was not developed or licensed by AutoCad. If you have some other sample files with Title Block Text, do share with us. This will help us while investigation.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

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