Alexy
Thank you for your reply. I have attached one of the original, source drawings (247499.idw.dwf within 247499.idw.7z) with this issue and a screenshot of the elements in question (247499.png).
As you may see in your testing, a few of the text elements are being read into the DwfWhipText objects’ Text property as the reverse single quote () and a few others are being read as lowercase n. The
should be the +/- symbol instead (ASCII 177) and the n should be the diameter symbol (ASCII 216).
There is a separate drawing I can provide shortly where the cylinder symbol (UTF16 9005) is being read into the DwfWhipText object as lowercase g.
As a workaround for this I do a character substitution with the following code:
Aspose.CAD.Image _cadImage (passed into method)
if (_cadImage is Aspose.CAD.FileFormats.Dwf.DwfImage)
{
Aspose.CAD.FileFormats.Dwf.DwfImage dwfImg = _cadImage as Aspose.CAD.FileFormats.Dwf.DwfImage;
List texts = dwfImg.Pages[0].Entities
.Where(e => e is DwfWhipText)
.Select(e => e as DwfWhipText)
.ToList();
foreach (DwfWhipText text in texts)
{
string replace = Char.ConvertFromUtf32(sub.Value);
text.Text.AsciiString = elementText.Replace(sub.Key, replace);
}
}
sub.Key is a string to be replaced (`, n or g) and sub.Value is an Int32 to replace it with (177, 216 or 9005);
While debugging this code I can confirm that the DwfWhipText.Text.AsciiString property is reassigned properly and as I can see the plus/minus, diameter and cylinder symbols when I hover over the AsciiString property. However, when rendering the final output, the substituted text in the resulting PDF only displays properly when sub.Value <= 255 (e.g. within the standard ASCII range). When sub.Value > 255, the result is an empty square.
In summary, I believe there is two separate issues at work here. The first is the initial DWF file load where it is misreading certain characters. The second is the PDF rendering where it does not render characters with an ASCII value above 255 properly.
The latter issue (PDF rendering) may be a font issue - I noticed the font in the resulting PDF is set to Arial Bold which may not have character definitions above char(255) which is why is outputs a blank square for cylinder (UTF16 9005) while the plus/minus and diameter render properly. I have other Arial fonts on my PC but not Arial Bold so my computer may be substituting another Arial-based font for Arial Bold. None of the Arial fonts on my PC appear to support anything beyond the standard ASCII characters. I have asked the client which font they use in the original CAD drawing and am awaiting a response. I have tried looking for fonts installed on my PC which support UTF16 characters and try rendering the drawings using that font instead.
247499.jpg (110.1 KB)
247499.idw.7z (197.3 KB)