Module: Gotenberg::PdfEngines::Tools
- Included in:
- Gotenberg::PdfEngines
- Defined in:
- lib/gotenberg/pdf_engines/tools.rb
Instance Method Summary collapse
-
#convert(*sources, format: 'PDF/A-1a') ⇒ Object
Converts PDF(s) to a specific PDF format.
-
#merge(*sources) ⇒ Object
Merges PDFs into a unique PDF.
Instance Method Details
#convert(*sources, format: 'PDF/A-1a') ⇒ Object
Converts PDF(s) to a specific PDF format. Gotenberg will return the PDF or a ZIP archive with the PDFs. gotenberg.dev/docs/modules/pdf-engines#convert. gotenberg.dev/docs/modules/pdf-engines#engines.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gotenberg/pdf_engines/tools.rb', line 26 def convert *sources, format: 'PDF/A-1a' sources.each do |source| files << multipart_file(*load_file_from_source(source)) end properties['pdfFormat'] = format @endpoint = '/forms/pdfengines/convert' @pdf_engines_convert = true self end |
#merge(*sources) ⇒ Object
Merges PDFs into a unique PDF. Note: the merging order is determined by the order of the arguments. See gotenberg.dev/docs/modules/pdf-engines#merge.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gotenberg/pdf_engines/tools.rb', line 10 def merge *sources sources.each.with_index(1) do |source, index| io, filename = load_file_from_source(source) files << multipart_file(io, merge_prefix(index) + filename) end @endpoint = '/forms/pdfengines/merge' self end |