PaperForge.Serializer (PaperForge v0.2.0)

Copy Markdown View Source

Serializes Elixir values into PDF syntax.

Supported values include:

  • integers and floats;
  • booleans and nil;
  • PDF names;
  • literal strings;
  • hexadecimal strings;
  • arrays;
  • dictionaries;
  • indirect references;
  • PDF streams.

Summary

Functions

Serializes a supported value as PDF iodata.

Types

pdf_hex_string()

@type pdf_hex_string() :: {:hex_string, binary()}

pdf_name()

@type pdf_name() :: {:name, binary()}

Functions

encode(value)

@spec encode(term()) :: iodata()

Serializes a supported value as PDF iodata.

Examples

PaperForge.Serializer.encode(42)
#=> "42"

PaperForge.Serializer.encode({:name, "Helvetica"})
#=> ["/", "Helvetica"]

PaperForge.Serializer.encode("Hello")
#=> ["(", "Hello", ")"]