Vakul Gupta
Vakul Gupta

Reputation: 120

What is PDF content stream and in what cases do we need to update this stream...?

I'm new to iText. I'm using iText 7.

  1. In iText 5 there were two content streams Under content and over content. What is the alternative in iText 7, If someone wants to add content in under or over content stream?

Upvotes: 0

Views: 399

Answers (1)

Uladzimir Asipchuk
Uladzimir Asipchuk

Reputation: 2458

Please create a PdfCanvas using PdfPage#newContentStreamBefore() or PdfPage#newContentStreamAfter()

For example, in the following snippet I will create a PdfCanvas instance for some already existed PdfPage instance (page)

PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc);

Then you can use this PdfCanvas instance as a usual one: the inly difference is that the content will be rendered before the other content (e.g. over)

Upvotes: 1

Related Questions