Skip to content

Display canvas on multiple pages. #1570

Answered by wojtekmaj
sverp asked this question in Q&A
Discussion options

You must be logged in to vote

I understand that your intention is to add a watermark to multiple pages.

It isn't obvious looking at the code, but you're actually attaching one ref to multiple Page components, and just one ends up getting stored for reference.

To work with multiple pages, you will need a more sophisticated solution, like a ref that is an object or an array. Then, canvasRef passed to Page needs to be a specially crafted function that stores the reference under specific object key/array index.

The rendering part also needs to be slightly adjusted. Because onRenderSuccess is going to be called n times where n is the number of pages, you will want to draw watermark directly in onRenderSuccess callback. You…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by wojtekmaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants