mileszs / wicked_pdf

PDF generator (from HTML) plugin for Ruby on Rails
http://www.mileszs.com/wicked-pdf-plugin
MIT License
3.52k stars 640 forks source link

Can we limit PDF pages? #1077

Closed Vicky099 closed 8 months ago

Vicky099 commented 9 months ago

Hello All,

I want to generate a PDF with only one page and ignore the rest of the pages. My first page might be override to second page but in that case I want to ignore that second page. Is it possible using Wicked_pdf?

unixmonkey commented 8 months ago

You can generate the PDF normally, then pass the PDF file or blob into another tool, like PDFtk to copy off the first page into another PDF like pdftk wicked_pdf_multipage.pdf cat 1 output single_page.pdf.

I think you could also use Prawn-templates to do this, as I've done something similar in the past, back when templates were part of Prawn core.