Copyright © 2003-2012 Joe Armstrong, Mikael Karlsson, Johan Bevemyr, Sean Hinde, Håkan Stenholm, Carl Wright
Version: Apr 6 2022 23:21:34
Authors: Joe Armstrong, Mikael Karlsson, Johan Bevemyr, Sean Hinde, Håkan Stenholm, Carl Wright.
The easiest way to start using ErlGuten is, if you are using rebar3, just to add
erlguten
as a dependency in rebar.config
:
{deps, [ erlguten ]}.
The following code is the minimum you need to create a one page PDF with calls to the pdf module.
PDF = eg_pdf:new(),
To create a pdf into which to put content
eg_pdf:set_pagesize(PDF, a4),
To set the page size of the PDF. Other choices are letter, legal, and lots of A and B formats
eg_pdf:set_page(PDF, 1),
To set the page you are working on
eg_pdf:set_font(PDF, "Victorias-Secret", 40),
To set the font to use until told different
eg_pdf:begin_text(PDF),
eg_pdf:set_text_pos(PDF, 50, 700),
eg_pdf:text(PDF, "Hello Joe from Gutenberg"),
eg_pdf:end_text(PDF).
To move to position (50,700) and place the "Hello Joe from Gutenberg" content
{Serialised, PageCount} = eg_pdf:export(PDF),
To create all the content of the pdf as a string in the term Serialised
file:write_file("../test/eg_test6.pdf", Serialised),
To output the pdf content into a finished PDF file
eg_pdf:delete(PDF).
Generated by EDoc