Module: Gotenberg::Libreoffice::Tools

Included in:
Gotenberg::Libreoffice
Defined in:
lib/gotenberg/libreoffice/tools.rb

Instance Method Summary collapse

Instance Method Details

#convert(*sources) ⇒ Object

Converts the given document(s) to PDF(s). Gotenberg will return either a unique PDF if you request a merge or a ZIP archive with the PDFs. Note: if you requested a merge, the merging order is determined by the order of the arguments. See gotenberg.dev/docs/modules/libreoffice#route.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gotenberg/libreoffice/tools.rb', line 11

def convert *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/libreoffice/convert'

  self
end