|
Rank: Member Groups: Member
Joined: 9/3/2013 Posts: 16
|
Hello, We are testing your PDF.Net component in a project but we found an error. As I see in this forum we can use special fonts, using TrueType font: - The TTF is installed in the server - The CSS has the font-face declaration like this Quote:@font-face { font-family: 'Cabin'; src: url("../fonts/Cabin-Regular.ttf") format('truetype'); src: local("../fonts/Cabin Regular") format('truetype'); font-weight: normal; font-style: normal; } I'm attaching rendered URL to PDF documents, as you can see in the bad document, the subtites fonts in H3, Strong or just using font-weight bold, the text renders any character. We force the H3 to use fontweight normal and remove the strong tags from subtitles and the texts are renderes as expected. So this is happeing with bold fonts. This is the URL we are rendering as pdf: http://rosencatalogo.fractus.cl/default.aspx?pgnID=3ac0d786-afe0-46e7-83ef-91c68f3da83e&itmID=3bb32ad3-6924-4c1d-adf1-6c5495d50acd&tmpID=BB23059A-C6C0-491A-B2AE-57674B8E440CBad Render: https://dl.dropboxusercontent.com/u/4642669/Bad%20-%20Rosen%20-%20Cotizaci%C3%B3n.pdfGood render: https://dl.dropboxusercontent.com/u/4642669/Good%20-%20Rosen%20-%20Cotizaci%C3%B3n.pdfThis is our code: Quote: HtmlToPdf.Options.PageSize = EO.Pdf.PdfPageSizes.A4; HtmlToPdf.Options.PreserveHighResImages = true; HtmlToPdf.Options.JpegQualityLevel = 80; HtmlToPdf.Options.GeneratePageImages = false; HtmlToPdfResult result = HtmlToPdf.ConvertUrl(cURL, pdfStream); Can you help us? Fractus - Developer & Consulting
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
I do not know why it renders the wrong character yet. We will look into that and get back to you soon. However I can explain why bold font is not rendered correctly.
Generally, different styles of the same font are in fact different fonts: For example, "Arial Normal" and "Arial Bold" are two different fonts and Windows has different font files for them. When you specify font face as "Arial" and font style as "Bold", windows automatically maps it to the "Arial Bold" font.
When the font file for the corresponding font style are missing, for example, in your case, when only Cabin-Regular.ttf is available but you wish to display Cabin Bold, Windows's GDI system is able to automatically synthesize the desired style. For example, by tiling the normal font to produce italic font, by doubling drawing a normal font with an offset to produce the bold effect, etc. The targeting device of this process is the screen, which is a bitmap device.
Unfortunately because we are outputting to PDF, so we can not duplicate the same process. Text in PDF files are not bitmap. They are in vector format. That's why you can zoom in a PDF file without losing quality (that's the very reason why PDF became very popular at the first place). This causes the direct result of if you only have "Normal", but not "Bold" available, then it won't synthesize the bold effect for you. However I would imagine it should automatically fall back to the "Normal" style instead of rendering the wrong character. We will look into that and reply again if we find anything.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/3/2013 Posts: 16
|
Thanks for the quick response, ok at this point we dont care if bold is not rendered as bold, just dont get random characters. If you can help us with this we'll be glad to buy the component. Fractus - Developer & Consulting
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Fractus wrote:Thanks for the quick response, ok at this point we dont care if bold is not rendered as bold, just dont get random characters. If you can help us with this we'll be glad to buy the component. Yes. That's what we are looking into and we will get back to you as soon as we find anything. Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We have not been able to reproduce the problem with the above Url. Can you provide a test HTML file that can be used to reproduce the problem and send the page to us? We will PM you as to where to send the test files.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/3/2013 Posts: 16
|
Hello, Right now Im sending an email with the necessary resources for you to test it. Thanks! Fractus - Developer & Consulting
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Thanks. We have received the email. We will look into it and get back to you as soon as possible.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We have posted a new build that should fix this problem. Please see your private message for the download location.
This new build should render bold correctly. Internally it double render the text with an offset, but in fact each individual rendering is the "normal" font.
Thanks!
|
|