DocRaptor HTML TO PDF API

Copying Text Content

Copying Text Content

Named strings let you copy text from an element and reuse it. This CSS behavior is part of the CSS Generated Content for Paged Media Module specifications, which are still a draft but helpfully supported by DocRaptor and Prince.

Copying content is most useful when you want to replicate something in your documents, such as inserting a chapter or section title into a header or footer.

The string-set property takes a name and a content definition, such as content() or attr(attribute-name). The content can be inserted via the content property and the string() function. For example:

h1 {
  string-set: chapter content(); 
}

@page {
  @top {
    content: string(chapter);
  }
}

Ready to get started? Try DocRaptor for free with unlimited test documents.