mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
474 B
25 lines
474 B
# frozen_string_literal: true
|
|
|
|
module PdfUtils
|
|
DEFAULT_DPI = 72
|
|
US_LETTER_W = DEFAULT_DPI * 8.5
|
|
|
|
module_function
|
|
|
|
def merge(io_files)
|
|
merged_content = StringIO.new
|
|
|
|
Pdfium.with_instance do
|
|
Pdfium::Document.create do |merged_pdf|
|
|
io_files.each do |io|
|
|
Pdfium::Document.open_io(io) { |pdf| merged_pdf.import_pages(pdf) }
|
|
end
|
|
|
|
merged_pdf.save(merged_content)
|
|
end
|
|
end
|
|
|
|
merged_content.tap(&:rewind)
|
|
end
|
|
end
|