- Home
- Forum
- ASP.NET Core - EJ 2
- DocIORenderer ConvertToPDF from Word document with underlined Text not working correctly
DocIORenderer ConvertToPDF from Word document with underlined Text not working correctly
Hi,
I am creating a Word document using Syncfusion.DocIO.Net.Core. The result is exactly how my customer wishes it to look like. However, as I need to create a PDF Version I convert the Word document to a PDF using DocIORenderer. Unfortunately the renderer creates an extra space on the underlined headline which looks ugly and is not accepted by my customer.
The code to create the pdf is simple
var render = new DocIORenderer();
render.Settings.EmbedFonts = true;
var pdfDocument = render.ConvertToPDF(wordDocument);
render.Dispose();
wordDocument.Dispose();
var pdfStream = new MemoryStream();
pdfDocument.Save(pdfStream);
pdfDocument.Close();
I have also attached the two documents created by my app. The font used is "Myriad Apple Text"
Could someone please advise how to overcome the issue? Thank you!
Attachment: FAC3920180830_AD1_MSC_Framework_Agreement_Alex_Komlew_cfa53208.zip
Hi Alexander,
On further analyzing the given details, we suspect that the reported underlined
text issue is specific to the font “Myriad Apple Text”. Since we couldn’t
get the font, we are unable to reproduce the reported issue in our end.
So, kindly share the font “Myriad Apple Text” from your end, which will be
helpful for us to reproduce the exact issue at our end and share the solution
at the earliest.
Regards,
Akash.
Hi Akash,
Thanks for your reply. I have attached the files of the font family as ZIP file.
However, your remark was a good one. I defined a different kind of the font family for the headline ("Myriad Apple" instead of "Myriad Apple Text") and with that the PDF conversion worked as expected. So there must be something "wrong" with the specific font and not your PDF render engine.
Kind Regards,
Alexander
Attachment: MyriadAppleText_166c680d.zip
Alexander, we have reproduced the reported problem “Underline
is not preserved properly while converting Word document to PDF” in our
end. We will validate this issue and update you with more details on 25th
September 2023.
Alexander, on further analysis, we have found that the input Word document uses the "Myriad Apple Text" font used for the text. But this font does not have a bold style. However, the input Word document has applied bold style to the text. When converting Word to PDF, we internally use the SkiaSharp library to measure the text range based on the font and the PDF graphic to render (draw) the text. Skiasharp measured width for the bold style applied text is different with PDF graphic measuring. Due to these differences, the underline will preserve even after the text. Since the issue is related to the font style, we need to investigate the issue in-depth and share the furthermore details on or before 27th September 2023.
Alexander, upon further investigation, we have found that the PDF library's measure string function is dependent on the font stream information. If the font stream does not have the bold style, the function will not measure the text properly. It will only measure the text properly if the font stream has the bold style. Therefore, we need to find a way to match these measurement differences in the word-to-PDF conversion process. Since this issue is specific to the font, it will take us some time to investigate it further. We kindly request your understanding and patience. We will investigate the issue in-depth and share the further details with you on or before September 29, 2023.
Alexander, as mentioned earlier, the input Word document uses the "Myriad Apple Text" font with the bold style. However, this "Myriad Apple Text Bold" font style may not be installed on your machine. If it is not installed, the issue will occur on your end. If the font("Myriad Apple Text Bold") is installed on your machine, the issue will be resolved.
If the "Myriad Apple Text Bold" font style is not
available on your machine, kindly use some other fonts either the "Myriad
Apple" font instead, or a standard font such as Calibri or Times New
Roman, with the bold style applied. This will resolve the issue.
Note: Our dependent PDF library's does not measure the text properly if the
font stream does not have the bold style.
- 6 Replies
- 3 Participants
-
AL Alexander
- Sep 19, 2023 06:36 PM UTC
- Sep 29, 2023 05:22 PM UTC