How to edit or write on existing PDF with Ruby?

前端 未结 7 1109
眼角桃花
眼角桃花 2020-12-01 10:35

I have a couple of PDF template files with complex content and several blank regions/areas in them. I need to be able to write text in those blank regions and save the resul

相关标签:
7条回答
  • I recommend prawn for generating PDFs and then using combine_pdf to combine two generated PDFs together into one. I use it like this and it works just fine.

    Short example (from the README) of how to combine two PDFs:

    company_logo = CombinePDF.load("company_logo.pdf").pages[0]
    pdf = CombinePDF.load "content_file.pdf"
    pdf.pages.each { |page| page << company_logo } # notice the << operator is on a page and not a PDF object.
    pdf.save "content_with_logo.pdf"
    
    0 讨论(0)
提交回复
热议问题