Python script to convert PDFs using non-Unicode Tibetan fonts in Unicode text.
The code is work in progress, use at your own risk!
The conversion tables come from a previous work for InDesign. The font tables from UTFC, UDP and ATTU have been extracted and kept in separate files. In debug mode, the code indicates where the two tables diverge and fixes are made over time to the non-UTFC tables.
Tables from Sambhota-converter (code) should be integrated.
If you have PDFs you would like to convert in the best quality, please send it to help AT bdrc.io, it will be converted and reviewed.
The code has a region
argument that specified PDF coordinates of the text to convert on each page; use it to remove headers, footer and marginal content.
pip install pdfminer.six
We want to thank:
The supported fonts (combining all the conversion tables) are:
The Tibetan Machine Web fonts have two different encodings:
They can be differenciated by looking at the encoding of the tsheg: if it corresponds to the ANSI hyphen (0x2D, decimal 45) it's the second encoding, else it's the first one.
We want to thank Leigh Brasington for this information.