Skip to content

Pdf insert_text with cyrilic encoding. #2686

@vb64

Description

@vb64

Hi there.

I ran the slightly modified example code from the documentation (How to Use Non-Standard Encoding) on two platforms.

  • Microsoft Windows [Version 10.0.14393]
  • Ubuntu 20.04.6 LTS
import fitz

assert 'PyMuPDF 1.23.3:' in fitz.__doc__
doc=fitz.open()
page = doc.new_page()
shape = page.new_shape()
shape.insert_text((50,70), "Hello world!", fontname="HELV", encoding=fitz.TEXT_ENCODING_CYRILLIC)
shape.insert_text((50,90), "Привет world!", fontname="HELV", encoding=fitz.TEXT_ENCODING_CYRILLIC)
shape.insert_text((50,110), "Привет мир!", fontname="HELV", encoding=fitz.TEXT_ENCODING_CYRILLIC)
shape.commit()
doc.save("t.pdf")

And I got the same results.

image

How can I get the correct text in Cyrillic in PDF?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions