We are trying to detect the text ‘PROFILO AUTORI’ as Bold and ‘Il controllo legale’ as Italic in the attached PDF but the ‘FontWeight’ & ‘ItalicAngle’ value always returning ‘Null’ or Zero. Please let me know how to achieve this through ‘CharIterator’.
Sample Code Taken from this Forum:
Dim italicangle As Double = 0
Dim BoldValue As Double = 0
Dim font_desc As Object = tfont.GetDescriptor()
If font_desc IsNot Nothing Then
Dim angle As Object = font_desc.FindObj(“ItalicAngle”)
If angle IsNot Nothing Then
italicangle = angle.GetNumber()
Else
italicangle = 0
End If
Dim tBold As Object = font_desc.FindObj(“FontWeight”)
If tBold IsNot Nothing Then
BoldValue = tBold.GetNumber()
Else
BoldValue = 0
End If
End If
We are trying to achieve the automatic creation of bookmark and replacing text inside the bold or italic format from the given pdf. Is there any way to identify the format information through character glyph path?
Going through the glyphs paths to determine boldness and italics is probably even harder. Typically font glyphs are filled, not stroked, so the boldness comes from how far apart the paths are, and not from a single stoke thickness value.
What do you mean by “replacing text”? This can mean a lot of things, some of which are again, are difficult to do.