Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make russian letters appear in pdf #1

Closed
epogrebnyak opened this issue Jun 25, 2018 · 1 comment
Closed

make russian letters appear in pdf #1

epogrebnyak opened this issue Jun 25, 2018 · 1 comment

Comments

@epogrebnyak
Copy link
Contributor

epogrebnyak commented Jun 25, 2018

We are creating a pdf on a Windows machine with:

pdf-creator/write_pdf.py

Lines 113 to 114 in 67768bc

# ERROR: xhtml2pdf cannot render Russian letters without patching
convertHtmlToPdf(html_out, locate('out.pdf'))

The call to do it is:

 python -m write_pdf

The Russian text in section header is illegible:

default

Possible remedies:

@epogrebnyak
Copy link
Contributor Author

epogrebnyak commented Jun 27, 2018

Selecting a dead-simple path to font (D:/arial.ttf) without cyrillic letters in it helped. Other solution could have been an URL to the font.

The solution is:

pdf-creator/write_pdf.py

Lines 34 to 44 in 27bbccd

# пробовали:
# @font-face { font-family: Arial; src: url('fonts/arial.ttf') }
template_doc = """<html>
<head>
<meta http-equiv="content-type"
content="text/html; charset=UTF-8">
<title>{{ page_header }}</title>
<style type="text/css">
@page { size: A4; margin: 1cm; }
@font-face { font-family: Arial; src: url('D:/arial.ttf') }

Tracing errors with logging as:

https://github.com/mini-kep/pdf-creator/blob/master/write_pdf.py#L10-L12

gave an such a wierd xhtml2pdf behaviour with __dummy__:

2018-06-26 22:12:05,617 - xhtml2pdf - DEBUG - URLParts: (ParseResult(scheme='c', netloc='', path='\\Users\\Евгений\\Documents\\GitHub\\pdf-creator\\__dummy__', params='', query='', fragment=''), 'c')
2018-06-26 22:12:05,619 - xhtml2pdf - DEBUG - Unrecognized scheme, assuming local file path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant