PaperForge.Writer (PaperForge v0.2.0)

Copy Markdown View Source

Serializes a PaperForge.Document into a valid PDF binary.

The writer is responsible for:

  • writing the PDF header;
  • serializing indirect objects;
  • calculating byte offsets;
  • generating the cross-reference table;
  • generating the trailer;
  • writing startxref and the EOF marker.

Summary

Functions

Converts a document into a complete PDF binary.

Functions

to_binary(document)

@spec to_binary(PaperForge.Document.t()) :: binary()

Converts a document into a complete PDF binary.

Example

binary =
  PaperForge.Writer.to_binary(document)

File.write!(
  "document.pdf",
  binary
)