I have a few hundred LibreOffice documents that I provide to my students as notes. They contain textbox fields that they use to put their answers etc. I would like to merge them into one document so that the chapter/section numbers are updated as I insert, delete, rearrange pages. I would also like to convert them to a markup language such as Markdown or Asciidoc to gain some other advantages for scripting that are unrelated to this question.
Once in this new format I will create PDF documents from individual sections of the master markup document on a regular basis as it is revised. I have done this with a tool such as Asciidoctor PDF and I like it because I can do syntax highlighting in the PDF output.
The part I need some direction with is getting textbox fields in the PDFs. I'm guessing markup languages don't have a tag for this. How about DocBook? Do I need to write some sort of preprocessor for the markup, converting some custom tag that is a stand-in for a textbox on it's way to becoming postscript? I don't know much about PDF or postscript. I'm open to other approaches as I haven't started writing any scripts.
In HTML, a textbox is a UI element. In PDF (or on paper), that would just be a "box".
There's no direct Asciidoc markup for making just-a-box, but there is markup that you could use creatively to achieve that goal.
For example, we could use a source block to specify a number of blank lines to define the amount of space that the box should have:
The
{nbsp}entries are using thenbspattribute, which introduces a non-breaking space. That prevents the source block from collapsing down to a single line. To use{nbsp}, we have to add thesubs="+attributes"to the[source]role, or you would see the{nbsp}text itself in the output instead of non-breaking spaces.You can adjust your asciidoctor-pdf theme to change the background, border, etc. See: https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc
If your document already uses source blocks, you might want to use a different kind of block that you are not already using, perhaps an example block, to get the border style that you want. To get the amount of space required, you might use a literal block: