gofpdf icon indicating copy to clipboard operation
gofpdf copied to clipboard

Dynamic Page Breaks

Open sinistersig opened this issue 7 years ago • 1 comments

I have a requirement where it is necessary for blocks of text to not be broken in the middle ie. if a page break is necessary the block should start on a new page. Is this possible?

sinistersig avatar Jun 18 '17 01:06 sinistersig

If the block of text uses only one font and attribute, the method SplitLines() will let you know how much vertical space will be required to render it. You could use this along with GetY() and SetAutoPageBreak(false, 0.0) to force a page break if the remaining space on the current page is not sufficient.

It would be nice to implement a Mark() method that would be followed by output methods and then either a Commit() or Rollback(). But that does not currently exist in gofdpf.

jung-kurt avatar Jun 18 '17 12:06 jung-kurt