Hi Nguyen,
We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for .NET 9.2.1, we have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWNET-36962 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.
Please feel free to contact us for any further assistance.
Best Regards,
Hi Nguyen,
Hi Nguyen,
Thanks for your patience. We have investigated the issue(PDFNEWNET-36962) and found it is not bug in Aspose.Pdf.
The point is that PDF-writer application have embedded ‘clipped’ versions of fonts into the document ‘Forhandler_Norsk.pdf’. It is for minimization of document size. PDF-editor software (Aspose.Pdf) has no access to complete version of source font. So, it can use embedded font to write ‘reldnahroF’, but not for any arbitrary text. If Aspose.Pdf finds embedded font contains not all of required glyphs it will perform font substitution. It is normal behavior of Aspose.Pdf.
Technical details: Text ‘Forhandler’ uses embedded font ‘RBKZAO+DIN-Bold’ font (obj 82) in the document. The font actually contains glyphs for F, a, d, e, h, l, n, o, r characters only. Another embedded fonts of the document are ‘NQWBWW+DIN-Regular’, ‘LACPUA+Futura-Book’, ‘KSSJGC+DIN-Medium’. All of them are ‘clipped’ versions of original fonts.
We may recommend to find source fonts of the document and install it into your system before document editing. Or you can use TextFragment.TextState.Font property to specify a font that is most similar to source font on your opinion.
For example, next code replaces original font to ‘Calibri’ font that looks similar:
var pdfDocument = new Document(myDir + “Forhandler_Norsk.pdf”);<o:p></o:p>
var textFragmentAbsorber = new
TextFragmentAbsorber(“Forhandler”);<o:p></o:p>
pdfDocument.Pages.Accept(textFragmentAbsorber);<o:p></o:p>
Aspose.Pdf.Rectangle
textRec = textFragmentAbsorber.TextFragments[1].Rectangle;<o:p></o:p>
textFragmentAbsorber.TextFragments[1].Text = “Aspose.Pdf”;<o:p></o:p>
textFragmentAbsorber.TextFragments[1].TextState.Font
= FontRepository.FindFont(“Calibri”);<o:p></o:p>
textFragmentAbsorber.TextFragments[1].TextState.FontStyle
= FontStyles.Bold;<o:p></o:p>
pdfDocument.Save(myDir + “FontChange_Calibri.pdf”);<o:p></o:p>
Please feel free to contact us for any further assistance.
Best Regards,