Open chalkedgoose opened 7 years ago
This can be done. I've been meaning to write an example that demonstrates my way of doing a boxed form like this. In a nutshell, you want to tabulate the coordinates of each box and drive the PDF generation from data rather than code. For example, declare a struct type that contains the coordinates (left, top, right, bottom) and other fields such as header or text contents. Define a slice of these structs populated with the appropriate values. Write a function that is called for each element. Don't worry about drawing lines over lines (for example, the left line of one box overwriting the right line of the previous box) -- the drawing is exact and the overdrawing will have no effect. Within that function, do the right thing based on the field value. For example, a zero value for the header string means to not write the header.
The trick is to measure everything in advance, and to minimize your code by putting as much detail into your data structure.
http://www.independentagent.com/Education/VU/SiteAssets/Documents/PDF/ACORD/ACORD27EvidenceOfPropertyInsurance.pdf