PDF forms with LaTeX: how to create \TextField of exactly 4in width? - forms

I'm using PDFLaTeX to create forms and ran into a problem with the \TextField macro that defines input fields:
\TextField[width=4in,name=sample]{}
The resulting field is a little wider than 4 inches and I don't understand why. The following example illustrates the problem by resulting in an overfull hbox which gets highlighted by an overfull rule.
\documentclass[a4paper,11pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[pdftex]{hyperref}
\overfullrule3pt
\begin{document}
\noindent \TextField[name=one, width=\hsize]{type here:}
\end{document}
The resulting PDF will show an overfull input field despite having specified exactly the available space as the desired width.

The author of the hyperref package, Heiko Oberdiek, sent me an email and explained why the width is by default greater than specified. Each \TextField is passed through the following macro for layout:
\def\LayoutTextField#1#2{% label, field
#1 #2%
}
Hence, we end up with the label, a space, and the input field. The width parameter only affects the input field. By re-defining the layout, we can ensure that we end up with the desired width as specified:
\def\LayoutTextField#1#2{#2}
This layout would simply drop the label ("type here:") to arrive at an input field of the desired width.

Related

Fillable Pdf multi-line, Allow rich text formatting in Acrobat Pro DC: but it ignores line spacing/leading set in More

I'm on Win10, using Acrobat Pro DC 2021.011... to edit and Reader DC (same version) to test.
From experience and from reading forums etc, forms in these apps are maddening... but I have not been able to find any discussion (or solutions) to the following behavior...
The form I'm building for other employees' use has a large edit text box set to Multi-line and Allow Rich Text Formatting. It is set to a default font, Calibri and size 50pt. For most situations this will work for them; provides 2-3 lines for a short product description. But occasionally they want a smaller font and more lines... They know how to get the ctrl+e properties bar. But in my testing of this alternative situation they'll need sometimes, I'm finding it's impossible to get the smaller font size and more lines to work. Here's my process.
tab into text box. Ctrl+E for properties bar.
before typing I set the font size to 24
then I type in my 4 lines of text
then I tab to my next form field...
and kaboom... the field I just filled...it's line height is so large it's pushed some of the content invisible. I assume this is coming from the field's default font size, 50
And if I try to adjust the line height, by selecting all the text and then choosing in More...>Form Field Text Properties>Paragraph>Line Spacing
If I set it to Single and click Close/click into another field I get the very large leading (presumably for 50pt font (same as pic above after point 5)
If I choose Exactly and set to point size slightly larger, click Close/out of field, I get another ridiculous result where the 2/3 line have the height I set, but the space between the 1 & 2 second line is way too much and the space between the last line and 3rd line is way too small...
before tabbing or clicking out of field to another field
Good lord.. what is that! 3 different leading values in the same field; just after applying 1 value to all lines, all text in the field...
It makes no sense... it doesn't look like it regards your input at all, and just comes up with it's own random leading... I've fiddled with Space before/after and combinations of Line Height and nothing comes close to what we need... At this point I'm convinced the Acrobat tools for a stylizing text in a multi-line, allow formatting text field are useless. I'd be better off with my employees they can't format anything, ever. Just type one line and hit Tab or Enter...
What is going on! I'm trying to make a simple fillable form for other employees to use, but this kind of behavior makes that impossible (It's enough of a stretch to teach them to use the ctrl+E and do some styling of their text but this is bonkers and completely unteachable... there's not rhyme or pattern to teach!)
Hope someone can help or has seen this behavior too.

TextMeshPro Input field - can't set placeholders' wrapping to enabled?

I am trying to have a TMP Input Field with multiline (wrapped) placeholder. The input field has its content type set to Integer Number. Placeholder text has some string as text and has wrapping set to "enabled". In prefab editor, it looks ok (text is wrapped). However, when the scene loads, placeholder text immediately has its wrapping reset to "disabled".
The problem: I assume Input field resets the wrapping to disabled on child text, because its content is not multiline, as specified here. I can't set the input field to accept multiline - the option is not in inspector; I can see it if I switch to Debug mode, but as soon as I set it to multiline it switches back to single line. So, how do I set the wrapping on placeholder to enabled without it getting switched back to disabled in runtime? Or, alternatively, how do I set my InputFiled to be multiline (I assume that will fix the wrapping on the placeholder)?
What I have for now:
I have an input field that works like this: when it's not focused, there is a multiline text, for example: "Write your\nnumber here!". When focused, it's replaced by empty line and user can enter an integer number. On finishing input (OnEndEdit) I use the input to spawn some GameObjects and then replace the text again with "Write your\nnumber here!". Editor screenshot:
Right now it works as I expect. However, now I want to dynamically change the placeholder text, so I don't know where the newline will be and I would like for TMP to wrap the text for me, same as it does in Text component with Wrapping enabled.
So: how do I use TMP's wrapping - enabled on InputField without it getting reset to disabled? Either both the user input and placeholder, or just on placeholder itself - doesn't matter.
MultiLine is only available if the Content Type is set to Standard or Auto Corrected.
As soon as you set the input type to Integer Number it basically behaves just like an integer field in the Unity Inspector: No line wrapping but rather overfloating and scrolling to the right.
Alternatively if you need multi lines you could set the Content Type to Custom and then fully flexible adjust it to your needs like e.g.
LineType : Multi Line Newline
Line Limit: 0
Input Type: Standard
Keyboard Type: Default
Character Validation: Integer
And in general: Of course you also can't set a text to an input field that only accepts integer numbers ;) Rather set your placeholder text in the Placeholder object!
Anything that is applied to the Placeholder will be displayed automatically as long as there is no value typed in the input field!

Line Spacing react-draft-wysiwyg

I want to implement Line Spacing options (single,double, exactly ,line per inch) in react-draft-wysiwyg editor but currently i don't think that it is support Custom line spacing , Open Issue , problem statement is i want to apply different line spacing on different paragraphs as per user input how i should be able to implement this feature ?
By changing line height of editor it will apply line height on whole editor but i want to be specific on user selected paragraphs
The solution is to set blockData and in render via blockstylefn set the correct style to block.
Take a look at these:
https://github.com/facebook/draft-js/issues/248#issuecomment-335010079
https://gist.github.com/joshdover/7c5e61ed68cc5552dc8a25463e357960.

Jasper Report: Text field overlapping end of page

Jasper report version 5.6.1 (due to a jdk 1.6 we MUSt use.....)
I have a report with a long text field in the bottom part of the page.
If i set Position type to "Fix Relative to Top" the text field will spread over the end of the page and the start of the next page using space available at the end of the first page (so from my point of view this is a correct behaviour, or may be the behaviour i'm searching for)
If i set position to float, the text (and the caomponent) will be moved directly to next page, so some part of the first page is not used at all, and all the text is printed on next page.
I have the same behaviour with a fixed text and with a text with field (evaluated at runtime).
I have tried to set Strech type to:
1) Relative to tallest object
2) Relative to Band Height
All previous element in the report are set to float (static text and text field)
So i would like to use remaining space on first page to print some line of this text Field , and use second page to print remaining text. Available space on first page is variable due to variable height of previous component on first page, so i cannot use Fixed position for this field.
Any idea will be appreciated

Put Alphabetical series in formula using HTML as Text interpretation

I am using a 3 way formula to put notes below the group footer of my Crystal Report. Please see below example for illustration
1. Text
a. Text
b. Text
2. Text
a. Text
b. Text
3. Text
a. Text
b. Text
c. Text
I was able to put the numerical series using a variable and increment it by 1, however in letters, I have seen a code to something like
chrw(96 + i) //where i is 1 based
But that wont work because my text interpretation is on HTML, are there alternatives? or conversion of the code for it to take effect in my formula.
chrw(ascw("`") + (var2 := var2+1))
the code above worked for me!, just set the variable var2 and initialize to 0 value. Do some conditioning to create an indention effect.