mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-29 13:48:54 +08:00
PageBreak drawable implementation
This commit is contained in:
parent
91660d88c4
commit
40f364059f
@ -115,7 +115,7 @@ func (chap *Chapter) Add(d Drawable) error {
|
||||
case *Chapter:
|
||||
common.Log.Debug("Error: Cannot add chapter to a chapter")
|
||||
return errors.New("Type check error")
|
||||
case *Paragraph, *Image, *Block, *Subchapter, *Table:
|
||||
case *Paragraph, *Image, *Block, *Subchapter, *Table, *PageBreak:
|
||||
chap.contents = append(chap.contents, d)
|
||||
default:
|
||||
common.Log.Debug("Unsupported: %T", d)
|
||||
|
19
pdf/creator/pagebreak.go
Normal file
19
pdf/creator/pagebreak.go
Normal file
@ -0,0 +1,19 @@
|
||||
package creator
|
||||
|
||||
// PageBreak represents a page break for a chapter.
|
||||
type PageBreak struct {
|
||||
}
|
||||
|
||||
// NewPageBreak create a new page break.
|
||||
func NewPageBreak() *PageBreak {
|
||||
return &PageBreak{}
|
||||
}
|
||||
|
||||
// GeneratePageBlocks generates a page break block.
|
||||
func (p *PageBreak) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error) {
|
||||
blocks := []*Block{
|
||||
NewBlock(ctx.Width, ctx.PageHeight),
|
||||
}
|
||||
ctx.Y = ctx.PageHeight
|
||||
return blocks, ctx, nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user