Comments (11)
Hey, I just made a new bump. Turns out to be easier than I thought. Performance might be a bit concerning but I will get to that later. Give v1.4.24 a try and let me know if there are more issues.
from pypdfform.
Hey, thanks for posting.
The issue you ran into was somewhat discussed in another thread, specifically I did a rather detailed explanation here.
In short, Adobe Acrobat seems to require way more complex metadata than browsers like Chrome for a text field widget to be rendered properly. This level of complexity is something that I'm unable to implement unfortunately. This is the largest reason why PdfWrapper
exists in the first place.
from pypdfform.
Thanks. The only downside of PdfWrapper
is that it does not implements automatic font size depending of the content as FormWrapper
do when the fields are correctly configured in the pdf. This cause me issues as the text overflow instead of reducing its size. especially for multi-line fields.
from pypdfform.
It’s normal for regular text field to overflow but that shouldn’t be the case for multi-line paragraph field. Could you post me an example?
Edit: unless for paragraph field it overflows vertically?
from pypdfform.
Only for multiline fields I think.
Here is an exemple:
from PyPDFForm import PdfWrapper
filled = PdfWrapper("report.pdf",).fill(
{
"301 What Happened": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris congue, lorem sit amet venenatis lacinia, quam tortor pharetra ante, id facilisis neque velit ac tellus. Nam tincidunt felis quis eros malesuada, ac congue elit consequat. Ut eget porttitor augue. Integer ullamcorper lectus et est scelerisque, ac posuere mi tempor. Nunc vulputate vehicula bibendum. Aliquam erat volutpat. Morbi tortor."
}
)
with open("filled.pdf", "wb+") as output:
output.write(filled.read())
Input: report.pdf
Output: filled.pdf
from pypdfform.
So in other words paragraph field overflows vertically. Ok this is actually expected behavior. I’ll implement an auto adjusting mechanism no later than the end of this week and get back to you.
from pypdfform.
Great ! Thanks a lot.
from pypdfform.
It works. Thanks !
I found that if I set the global_font_size
, it overrides the new adaptative font behavior though.
Is the default font size used by PdfWrapper
come from the PDF configuration or it is embeded in the lib ?
from pypdfform.
When you set a font size, I assume you know what you are doing and know the risk of larger font size would potentially cause texts overflowing. So yes setting font size does overwrite the auto adjust behavior.
The default font size for paragraph field is set to 12 and embedded into the lib. I don't know how to extract that info out of a PDF. If you happen to know I'm all ears.
from pypdfform.
Make sense.
No, I don't know a way to extract that info out of a PDF.
Maybe in the future, I will make a pull request to add an optional parameter "default_font_size" to override the embedded 12 while maintaining the automatic font adjustment.
But my issue is well resolved. Thanks for your help.
from pypdfform.
Hey man, I know this might be a bit late into the party but just want to throw this here if you still need it: https://chinapandaman.github.io/PyPDFForm/simple_fill/#adobe-mode-beta
It's still in beta and there are some hiccups with this messing up checkbox and radio button styles. But I tested your template and it should be good for at least text fields.
from pypdfform.
Related Issues (20)
- PPF-634: modify pdf diff scripts for codespaces
- PPF-638: release 1.4.26
- PPF-640: move adjust font size functions to font.py
- PPF-641: implement Adobe mode
- PPF-642: update docs for Adobe mode
- PPF-646: release 1.4.27
- PPF-648: fully remove deprecated features in 1.4.0
- PPF-649: add more tests for Adobe mode
- PPF-650: remove the linting ignore in filler.py
- Fields are no longer editable HOT 2
- PPF-656: release 1.4.28
- PPF-658: add CONTRIBUTING
- PPF-660: add code of conduct
- PPF-662: add security policy
- PPF-664: create issue template
- PPF-666: create PR template
- PPF-668: change issue template to follow the GitHub guidelines
- PPF-670: add clean temp dir script
- PPF-672: remove issue title template
- PPF-674: add description section in issue template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypdfform.