Skip to content

Instantly share code, notes, and snippets.

View Saraeutsza's full-sized avatar

Sarawut Kaewyana Saraeutsza

View GitHub Profile
@Saraeutsza
Saraeutsza / pdf_merger.rb
Created August 11, 2024 07:51 — forked from wakproductions/pdf_merger.rb
Merging PDFs with Prawn
class PdfMerger
def merge(pdf_paths, destination)
first_pdf_path = pdf_paths.delete_at(0)
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf|
pdf_paths.each do |pdf_path|
pdf.go_to_page(pdf.page_count)