Welcome Guest Search | Active Topics | Sign In | Register

Converting Spanish HTML to PDF Problem Options
Bob Pinella
Posted: Tuesday, April 17, 2018 10:33:15 AM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Hello,
I am having a problem converting Spanish text in an HTML file to a PDF using the HtmlToPdf C# class. Special Spanish characters are not rendering correctly in the PDF document. They do render correctly in Chrome so it has something to do with the conversion process. For example, the upside down exclamation point gets rendered as ¡. If I change the upside down exclamation point to ¡, then it renders correctly in the PDF. I would like to avoid converting all of the special Spanish characters to HTML codes - are there any options for converting Spanish characters correctly? I looked at the docs for HtmlToPdfOptions but didn't see anything that was language or character set related. My converted HTML file is currently using Calibri font. I would be happy to provide any additional information that you might need, so please let me know at your earliest convenience. Thank you for your time.

Bob Pinella
Bob Pinella
Posted: Monday, April 23, 2018 5:11:42 PM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Can anyone from support provide me with some guidance on this issue?
eo_support
Posted: Monday, April 23, 2018 8:23:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Sorry about late replying. Can you send the HTML file to us and we will be happy to investigate further. See here for more information on how to send test files to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
Bob Pinella
Posted: Tuesday, April 24, 2018 4:50:43 PM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Thank you for the reply - the problem went away while I was trying to create a test page for you. Currently, the HTML template we use is an Aspx page, but transferring to a separate HTML file fixed it. It seems to be an issue with this particular aspx page so I am currently investigating and will let you know if I need further assistance.

Bob
Bob Pinella
Posted: Tuesday, April 24, 2018 5:38:42 PM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Ok I am experiencing some strange results - When I copy the HTML from the html page to an aspx page with no other code, the problem occurs again. When I create the test project, I saw the opposite result - the HTML page has the issue and the aspx page works correctly. The only difference between the two is that I am using Server.Execute to get the HTML in the test project and I am using the WebClient class in our test environment(Because the template is located in a different web site). The test project requires EO.pdf.dll in order to work properly but your guidelines suggest not to include your library. Do you want me to send you the test project without it? Let me know at your earliest convenience. Thank You.

Bob
eo_support
Posted: Tuesday, April 24, 2018 5:45:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

This may have to do with your page encoding. Encoding defines which binary code represents which character. So when you copy back and forth with different encoding, you can run into this kind of problem. So make sure you check the encoding settings both for your ASP.NET page as well as the HTML page and make sure they match.

Thanks!
Bob Pinella
Posted: Wednesday, April 25, 2018 11:14:40 AM
Rank: Member
Groups: Member

Joined: 10/14/2014
Posts: 17
Thank you for the reply - this helped me identify the issue and a solution. It turns out that the default encoding for the C# WebClient class is ISO-8859-1 which doesn't display Spanish characters properly. When I set the encoding of the WebClient object to UTF8, the conversion to the PDF document worked correctly. Thank you for your assistance with this, I appreciate it.

Bob
eo_support
Posted: Wednesday, April 25, 2018 1:46:08 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
You are very welcome. Glad to hear that you found out the root cause.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.