Module: Gotenberg::Libreoffice::Files

Included in:
Gotenberg::Libreoffice
Defined in:
lib/gotenberg/libreoffice/files.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.



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

def convert *sources
  sources.each.with_index(1) do |source, index|
    files << multipart_file(IO.binread(source), merge_prefix(index) + File.basename(source))
  end

  @endpoint = '/forms/libreoffice/convert'

  self
end