Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to render content behind the template page? #27

Open
brandoncc opened this issue May 24, 2020 · 3 comments
Open

Is it possible to render content behind the template page? #27

brandoncc opened this issue May 24, 2020 · 3 comments

Comments

@brandoncc
Copy link

I need to render an image behind the content from the template. Is that possible?

@gettalong
Copy link
Member

It is possible in general but prawn-template doesn't currently implement it as far as I can tell.

@brandoncc
Copy link
Author

brandoncc commented May 26, 2020 via email

@gettalong
Copy link
Member

So have a look at https://github.com/prawnpdf/prawn-templates/blob/master/lib/pdf/core/page.rb#L29-L41

This is where two additional content streams (a page can have zero, one or more content streams representing the contenst) are added to the page:

  • The first is added before the current content stream, i.e. the contents of the existing page, containing just one instruction for saving the graphics state.
  • The second is added after the current content stream, restoring the graphics state so that Prawn has a pristine version of the graphics state to start.

What you need to do is modify the first content stream to not only save the graphics state as last instruction but also draw the image you want.

As far as to what the best way for this to accomplish would be, it depends on whether this should work just for the one case you have in mind or in a general way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants