TextField fontsize changes after editing content
See original GitHub issueFeature requests, bug reports etc. are very welcome as issues. But questions are directed to stackoverflow with the tag jspdf
.
If you are facing issues with utf-8 characters, please refer to #2677.
Note that bug reports should follow these guidelines:
- A bug should be reported as an mcve
- Make sure code is properly indented and formatted (Use ``` around code blocks)
- You can run example here http://raw.githack.com/MrRio/jsPDF/master/ for AcroForms and download pdf and check the font size on chrome browser Initial font size for input value is ok when we chnge text it appear larger
/* global jsPDF */
var doc = new jsPDF();
var {
TextField,
Appearance
} = jsPDF.AcroForm;
doc.setFontSize(12);
doc.text("TextField:", 10, 145);
var textField = new TextField();
textField.Rect = [50, 140, 30, 10];
textField.multiline = false;
textField.value ="Test value"; //
textField.fieldName = "TestTextBox";
doc.addField(textField);
- Please check ath attached Pdf and open it in chrome browser it show larger text inside input fields. AcroForms (2).pdf
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
TextField fontsize changes after editing content #3071 - GitHub
Once a field is edited by the user, it's font and font size properties are stable (but they are NOT the font and...
Read more >Cannot change font size of text field in material ui
Here's what I had to do to change the size of the text both before (label) and after (input text) the user interacts...
Read more >Change the default font for adding text and fallback font for ...
Go to Edit > Preferences > Content Editing > Font Options. Select an appropriate font in the Fallback font for editing drop-down list....
Read more >Text in Compose - Jetpack - Android Developers
You may want to adjust lineHeight using the text unit “em” (relative font size) instead of “sp” (scaled pixels) for improved precision. More...
Read more >Using the rich text editor - Relativity Documentation
Set the long text field with the Display Type: Inline Rich Text. On the layout builder, make the long text field two column....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have this issue as well. Not only does font size change, but the font itself changes. I forked markandan’s codepen. I set the font and added starting text. On opening the pdf, it correctly uses Times font but not the 20 font size. When you click the text field, the font changes from Times to something else (sans serif), and it gets bigger (maybe the correct 20 font size).
Setting multiline = true altered the behavior. The font size gets smaller or stays the same when selected. But the font still definitely changes!
Once a field is edited by the user, it’s font and font size properties are stable (but they are NOT the font and font size set in the text field’s properties!). (EDIT: this is not exactly true. It looks like jsPDF is setting the fontSize to “auto” somehow. As a field’s content grows, the font size shrinks in an effort to fit it. I know this is not the way a pdf has to operate. Is there any way to create truly fixed font size using jsPDF?)
https://codepen.io/wwp5550/pen/zYWgBbE
Have exactly the same issue. Found out as a quick fix workaround you can set formField.multiline = true; Then it does not change the fontSize while and after editing 🤷🏻♂️