hand-dot / labelmake

labelmake has moved and now available at pdfme / https://github.com/pdfme/pdfme

Home Page:https://labelmake.jp/javascript-pdf-generator-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[2.0.19] Feature Request: Schema/Page repeat for overflowing boxes

lanterieur opened this issue · comments

Related to #50

Description:

  • Add the option to repeat a schema/page when given fields overflow

Use cases:

  • Long text spanning across pages
  • Article template

Request:

  • Add a property to field schemas which marks them as triggers to repeat the page when overflown
  • Add a property to field schemas which marks them as removed from repeat pages. This property has to be exclusive of the previous.
  • To give the example of an article with the title above and a page number below, we may flag the article columns as overflowing and the title as being removed. The pages after the first would not display the title, but display the text continuation and keep incrementing the page number.
const schemas = [{
  mainTextField: {
    overflowOnNextPage: {Boolean},
    removeFromNextPage: {Boolean},
    type,
    width, // required to work
    height, // required to work
    position,
    rotate,
    alignment,
    fontName,
    fontSize,
    fontColor,
    backgroundColor,
    characterSpacing,
    lineHeight
  }
}];
  • Add a property to schema which toggles this functionality
const schemas = [{
  enableOverflowOnNextPage: {Boolean},
  mainTextField
}];

Similar to #50, labelmake does not necessery need to be aware that there is a relationship between pages. Processing each page in series, after processing page A and finding out that mainTextField is overflown with overflowOnNextPage set to true, then, label make can copy the source schema, remove the fields with removeFromNextPage==true, replace the text with the remaining overflowing text and add this copied modified schema next in the queue. This will repeat until there is no overflow.