katerina7479 / pypdflite Goto Github PK
View Code? Open in Web Editor NEWA lightweight utility for creating PDF files, written in Python
License: MIT License
A lightweight utility for creating PDF files, written in Python
License: MIT License
I'm curious if there's a plan to support non-english characters in pypdflite, and if so, what is the preferred approach? I'm working on adding this support in a fork I've made, and I would love to get any input from you about how you envision this working.
I believe it's a matter of loading a full unicode font, but also something else?
Any input you have would be hugely valuable. Thanks again for creating such a helpful module!
I've tried forking and outputting text using UTF-16BE that PDFs support but can't seem to get it to render without interpreting the two-byte chars as two different characters. Maybe it is a font issue. Do you have interest in fixing or should I migrate to report lab or something similar?
The pngtest.py references three png files. These files are missing:
bin/example.png
bin/apple_logo.png
bin/background.png
When I try to run the TrueTypeTest, it fails with the error:
"Exception: comic sans ms not a valid font name"
The core problem seems to be the FontLoader.get_ttf() generating the TTF font dictionary with entries like this:
'comic_sans_ms': '/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf'
If I change the test to load the comic_sans_ms
font the test passes. But fails on the Arial Bold loading. Again looking at the dictionary, I find:
'arial__italic': '/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf'
meaning the naming process puts two underscores between the font name and the style.
Maybe % should be escaped with %% in pypdflite/pdfobjects/pdfcell.py line 46
is:
self.text = '%s %' % self.text
would work:
self.text = '%s %%' % self.text
Sorry for the "patch" form: newbie with Git
Hi there,
Thanks for pypdflite!
When I try to add png image I get the Exception('Missing Palette'), not sure why. It doesn't happen with any other png file. I edited the original file after the first time I got the exception. It only uses 4 colors and is basically black and white. Any ideas?
Thanks!
Hello
I use your great library to create a bunch of pdfs.
I wnat to include a series of image with a foot text in the center of the page
The proble is, that they have different width, so I cnnot set the cursor precisely.
Is there a generic way to center the images and texts?
Trying to update to the latest code, I get an error when doing a pip install -U pypdflite
due to a reference to bin/runexamples.py
in the setup.py
file on line 9, which reads:
scripts=['bin/runexamples.py'],
In your last commit the runexamples.py file moved to the root of the project, so I believe that line should be:
scripts=['runexamples.py'],
(Thanks for the great work here!)
>>> import pypdflite
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/pypdflite/__init__.py", line 1, in <module>
from pdflite import PDFLite
File "/usr/lib/python2.7/site-packages/pypdflite/pdflite.py", line 4, in <module>
from .pdfdocument import PDFDocument
File "/usr/lib/python2.7/site-packages/pypdflite/pdfdocument.py", line 13, in <module>
from pdfobjects.pdfttfonts import PDFTTFont
File "/usr/lib/python2.7/site-packages/pypdflite/pdfobjects/pdfttfonts.py", line 8, in <module>
TTFONTS = pickle.load(open(os.path.join(FONT_DIR, 'font_dict.p'), 'rb'))
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/site-packages/pypdflite/fonts/font_dict.p'
I installed pypdflib with pip. The font file is missing from MANIFEST, which suggests you need to create a MANIFEST.in and list them there. (Note it should be MANIFEST.in, not MANIFEST.ini.) Further, your setup.py may need to be altered to ensure the font_dict.p is installed in the expected place.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.