Packages

An elixir client for interacting with Gotenberg

Current section

Files

Jump to
gotenberg_elixir lib test pdf_test.ex
Raw

lib/test/pdf_test.ex

defmodule PdfTest do
@moduledoc false
def test_convert do
file = {"file.pdf", File.read!("lib/test/data/file.pdf")}
{:ok, %{body: body}} = GotenbergElixir.Pdf.convert([file], pdfua: true)
File.write!("lib/test/results/test.pdf", body)
end
def test_read_pdf_metadata do
file = {"file.pdf", File.read!("lib/test/data/file.pdf")}
{:ok, %{body: body}} = GotenbergElixir.Pdf.read_pdf_metadata([file])
IO.inspect(body)
end
def test_write_metadata do
file = {"file.pdf", File.read!("lib/test/data/file.pdf")}
{:ok, %{body: body}} =
GotenbergElixir.Pdf.write_pdf_metadata([file],
metadata: %{"Title" => "Test PDF", "Author" => "GotenbergElixir"}
)
File.write!("lib/test/results/test.pdf", body)
{:ok, %{body: body}} =
GotenbergElixir.Pdf.read_pdf_metadata([{"test.pdf", body}])
IO.inspect(body)
end
end