Resolve "PDF Export Layout" #146
The following is very un-fancy, however it covers the two most important cases, page wrapping and line wrapping
Page wrapping
This part is probably more important, it handles tracking the current y position we are writing to, and, when the line would be written below the page margin, we add a new page to the document
Note we only add a new page when trying to write a new line that would go beyond the page margin, to avoid adding a potential blank page at the end of the document
Testing
To test this simply use a report that has engouh entries that would require multiple line breaks. The ExampleIncomingData will fill this requirement
Line wrapping
This is probably more of an edge case, but in the eventuality that an answer or (more likely) a question text is too long that it would go beyond the width of the page, we need to introduce a line break. Unfortunately the code to determine this is not built in, and a little more complicated than page breaks. Here we do a bisection search, to determine the maximum length of words that could fit on a line, before extending beyond the margins, then we repeat this until the entire line has been parsed into its respective line breaks.
This shouldn't come up quite as often, so in the case where it's not necessary to introduce a line break at all, we simply skip the bisection search, and write the line directly to the pdf.
One shortcoming of the current line wrapping, is that it can only line wrap based on spaces, and not, for example, within long words (may prove problematic with long German words
Testing
To test this, you'll need to write a line with more text in it. The questions in the example data aren't long enough. Either you'll need to edit the translations for the example incoming data
Or, alternatively, you can just add a line to write some dummy lipsum-like text in the pdf service, that' long enough to warrant a line break
Closes #146