Module eg_pdf

Behaviours: gen_server.

Data Types

color()

color() = atom() | {0..255, 0..255, 0..255}

dash()

dash() = solid | dash | dot | dashdot | [number()]

image_size()

image_size() = {width, W::number()} | {height, H::number()} | {W::number(), H::number()} | {max, W::number(), H::number()}

line_cap()

line_cap() = flat_cap | round_cap | square_cap

line_join()

line_join() = miter_join | round_join | bevel_join

pagesize()

pagesize() = a0 | a1 | a2 | a3 | a4 | a5 | a6 | a7 | a8 | a9 | b0 | b1 | b2 | b3 | b4 | b5 | b6 | b7 | b8 | b9 | b10 | c5e | comm10e | dle | executive | folio | ledger | legal | letter | tabloid

pdf()

pdf() = pid()

pdf_string()

pdf_string() = [] | [char() | pdf_string()] | [pdf_string() | pdf_string()]

stroke_type()

stroke_type() = close | stroke | close_stroke | fill | fill_even_odd | fill_stroke | fill_then_stroke | fill_stroke_even_odd | close_fill_stroke | close_fill_stroke_even_odd | endpath

text_rendering()

text_rendering() = fill | stroke | fill_then_stroke

Function Index

begin_text/1Begins a text object in PDF.
bezier/5Creates a cubic Bezier curve.
bezier/9Creates a cubic Bezier curve.
bezier_c/4Creates a cubic Bezier curve.
bezier_v/3Creates a cubic Bezier curve.
bezier_y/3Creates a cubic Bezier curve.
break_text/1Breaks line in a text object.
circle/3Strokes a circle centered at X, Y with a radius of R.
color/1Returns RGB value of a color name.
delete/1Clears up - use it to clean resources used to generate PDF.
ellipse/3Strokes an ellipse centered at X,Y with an X-radius of RX and a Y-radius of RY.
end_text/1Ends a text object in PDF.
export/1Returns a tuple with {binary with PDF contents, page count}.
get_page_no/1Returns current page number.
get_string_width/3Calculates the length in points of the String stroked in FontName of size FontSize.
get_string_width/4Calculates the length in points of the String stroked in FontName of size FontSize.
grid/3Creates a grid.
image/2Adds an image.
image/3Adds an image.
image/4Adds an image.
inBuiltFonts/0This returns a list of strings that name the standard "in-built" fonts.
kernedtext/2Inserts Texts into PDF with precise kerning in the Texts list.
line/2Draws a line from X1, Y1 to X2, Y2.
line/3Draws a line from X1, Y1 to X2, Y2.
line/5Draws a line from X1, Y1 to X2, Y2.
lines/2Draws a list of lines.
move_to/2Begins a new subpath by moving to the X,Y coordinates with no connecting line segment.
new/0Initiates PDF building process, returns a handle to use in other functions.
new_page/1Starts a new page in PDF.
pagesize/1Returns bounding box of the page as {0, 0, Width, Height}.
path/2Indicates how to process the current path.
poly/2Creates a path starting at the first Point and then to each following Point.
rectangle/3Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX,WY.
rectangle/4Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX, WY.
rectangle/5Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX, WY.
rectangle/6Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX, WY.
restore_state/1Restores the graphics state off the graphics state stack.
rotate/2Uses the angle given to rotate the graphics coordinate space.
round_rect/4Draws a rounded rectangle path.
round_top_rect/4Draws a rounded rectangle path with only the top corners rounded.
save_state/1Saves the graphics state on the graphics state stack.
scale/3Changes the size of the text object in the X and Y directions.
set_author/2Sets the Author atribute of the PDF.
set_dash/2Selects the stroke style for lines.
set_date/4Sets the Date atribute of the PDF.
set_fill_color/2Sets the fill color.
set_fill_color_RGB/4Sets the fill color to use by subsequent functions.
set_fill_gray/2Sets the fill color of as gray.
set_font/3Sets the font and the font size to be used by subsequent functions.
set_keywords/2Sets the Keyword attribute of the PDF.
set_line_cap/2Controls the ends of open subpaths and dashes in subsequent functions.
set_line_join/2Controls shape of connections of consecutive segments of a path.
set_line_width/2Sets the line width for subsequent functions.
set_page/2Goes to a page already created.
set_pagesize/2Sets the page size.
set_pagesize/3Sets the page size with explicit width and height.
set_stroke_color/2Sets the stroke color.
set_stroke_color_RGB/4Sets the stroke color to use by subsequent functions.
set_stroke_gray/2Sets the stroke color of as gray.
set_subject/2Sets the Subject atribute of the PDF.
set_text_leading/2Sets the distance between the baselines of adjacent lines of text.
set_text_pos/3Sets the start position to begin painting text.
set_text_rendering/2Sets the text rendering mode parameter.
set_text_rise/2Raises or lowers the baseline for the following text.
set_text_scale/2Sets the horizontal scaling of the following glyphs.
set_title/2Sets the Title attribute of the PDF.
skew/3Changes the X,Y cordinate directions from 0 degrees for X and 90 for Y.
text/2Inserts the content of the String into PDF.
text_rotate/2Uses the angle given to rotate the text coordinate space.
text_rotate_position/4Uses the angle given to rotate the text coordinate space.
text_transform/7Allows for any linear transformation for text.
textbr/2Inserts the content of the String into PDF and starts new line.
transform/7Allows for any linear transformation for graphics.
translate/3Translates the origin of the coordinate system.

Function Details

begin_text/1

begin_text(PDF::pdf()) -> ok

Begins a text object in PDF.

bezier/5

bezier(PDF::any(), P1::{X1::number(), Y1::number()}, P2::{X2::number(), Y2::number()}, P3::{X3::number(), Y3::number()}, P4::{X4::number(), Y4::number()}) -> ok

Creates a cubic Bezier curve. This moves to X1,Y1 point as its start and then creates a cubic Bezier curve to X4,Y4 using the points in between as the control points. Bezier paths should be stroked/closed/filled with a separate command.

bezier/9

bezier(PDF, X1, Y1, X2, Y2, X3, Y3, X4, Y4) -> any()

Creates a cubic Bezier curve. This moves to X1,Y1 point as its start and then creates a cubic Bezier curve to X4,Y4 using the points in between as the control points. Bezier paths should be stroked/closed/filled with a separate command.

bezier_c/4

bezier_c(PDF, Point1, Point2, Point3) -> any()

Creates a cubic Bezier curve. This takes the current point as its start and then creates a cubic Bezier curve to Point3 using the points in between as the control points. Bezier paths should be stroked/closed/filled with a separate command.

bezier_v/3

bezier_v(PDF, Point1, Point2) -> any()

Creates a cubic Bezier curve. This takes the current point as its start and then creates a cubic Bezier curve to Point2 using the current point and Point1 as the control points. Bezier paths should be stroked/closed/filled with a separate command.

bezier_y/3

bezier_y(PDF, Point1, Point3) -> any()

Creates a cubic Bezier curve. This takes the current point as its start and then creates a cubic Bezier curve to Point3 using the Point1 and Point3 as the control points. Bezier paths should be stroked/closed/filled with a separate command.

break_text/1

break_text(PDF::pdf()) -> ok

Breaks line in a text object.

circle/3

circle(PDF::pdf(), C::{X::number(), Y::number()}, R::number()) -> ok

Strokes a circle centered at X, Y with a radius of R.

color/1

color(Color::color()) -> {0..255, 0..255, 0..255}

Returns RGB value of a color name. You can find color names in eg_pdf_op.

delete/1

delete(PDF::pdf()) -> ok

Clears up - use it to clean resources used to generate PDF.

ellipse/3

ellipse(PDF::pdf(), C::{X::number(), Y::number()}, R::{RX::number(), RY::number()}) -> ok

Strokes an ellipse centered at X,Y with an X-radius of RX and a Y-radius of RY. Creates an ellipse with center in X, Y and radiuses RX, RY. Ellipses should be stroked/closed/filled with a separate command.

end_text/1

end_text(PDF::pdf()) -> ok

Ends a text object in PDF.

export/1

export(PDF::pdf()) -> {binary(), integer()} | no_return()

Returns a tuple with {binary with PDF contents, page count}.

get_page_no/1

get_page_no(PDF::pdf()) -> pos_integer() | no_return()

Returns current page number.

get_string_width/3

get_string_width(FontName::pdf_string(), PointSize::number(), String::pdf_string()) -> number()

Calculates the length in points of the String stroked in FontName of size FontSize.

get_string_width/4

get_string_width(PDF::pdf(), FontName::pdf_string(), FontSize::number(), String::pdf_string()) -> number()

Calculates the length in points of the String stroked in FontName of size FontSize.

grid/3

grid(PDF, XList, YList) -> any()

Creates a grid. Grid assumes sorted XList and YList, minimum value first.

image/2

image(PDF::pdf(), FilePath::string()) -> ok | {error, term()}

Adds an image

image/3

image(PDF::pdf(), FilePath::string(), Size::image_size()) -> ok | {error, term()}

Adds an image.

image/4

image(PDF::pdf(), FilePath::string(), P::{X::number(), Y::number()}, Size::image_size()) -> ok | {error, term()}

Adds an image.

inBuiltFonts/0

inBuiltFonts() -> any()

This returns a list of strings that name the standard "in-built" fonts.

kernedtext/2

kernedtext(PDF::pdf(), Texts::[pdf_string() | char() | integer()]) -> ok

Inserts Texts into PDF with precise kerning in the Texts list. It has a format like ["A", 120, "W", 120, "A", 95, "Y"]. The numbers between the stgring adjust the distance between them. The unit of measure is thousandths of a unit of text space. You can have strings or single letters between the numbers.

line/2

line(PDF::any(), FromTo::{{X1::number(), Y1::number()}, {X2::number(), Y2::number()}}) -> ok

Draws a line from X1, Y1 to X2, Y2. The line shape, color, etc. is defined by the graphics state.

line/3

line(PDF::any(), From::{X1::number(), Y1::number()}, To::{X2::number(), Y2::number()}) -> ok

Draws a line from X1, Y1 to X2, Y2. The line shape, color, etc. is defined by the graphics state.

line/5

line(PDF::any(), X1::number(), Y1::number(), X2::number(), Y2::number()) -> ok

Draws a line from X1, Y1 to X2, Y2. The line shape, color, etc. is defined by the graphics state.

lines/2

lines(PDF, LineList) -> any()

Draws a list of lines. The LineList has entries of values like those needed for the line function.

move_to/2

move_to(PDF::any(), P::{X::number(), Y::number()}) -> ok

Begins a new subpath by moving to the X,Y coordinates with no connecting line segment.

new/0

new() -> any()

Initiates PDF building process, returns a handle to use in other functions.

new_page/1

new_page(PDF::pdf()) -> integer() | no_return()

Starts a new page in PDF. Note page 1 is already created by default and current page set to it after calling new().

pagesize/1

pagesize(X1::pagesize()) -> {0, 0, pos_integer(), pos_integer()}

Returns bounding box of the page as {0, 0, Width, Height}.

path/2

path(PDF::pdf(), StrokeType::stroke_type()) -> ok

Indicates how to process the current path.

poly/2

poly(PDF, Points) -> any()

Creates a path starting at the first Point and then to each following Point. Each Point in the Points list is a tuple {X,Y}. Poly paths should be stroked/closed/filled with a separate command.

rectangle/3

rectangle(PDF::pdf(), P::{X::number(), Y::number()}, S::{WX::number(), WY::number()}) -> ok

Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX,WY. It is drawn according to the selected StrokeType. You need to call path/2 to stroke the path.

rectangle/4

rectangle(PDF::pdf(), P::{X::number(), Y::number()}, S::{WX::number(), WY::number()}, StrokeType::stroke_type()) -> ok

Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX, WY. It is drawn according to the selected StrokeType.

rectangle/5

rectangle(PDF::pdf(), X::number(), Y::number(), WX::number(), WY::number()) -> ok

Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX, WY. It is drawn according to the selected StrokeType. You need to call path/2 to stroke the path.

rectangle/6

rectangle(PDF::pdf(), X::number(), Y::number(), WX::number(), WY::number(), StrokeType::stroke_type()) -> ok

Creates a rectanglar path whose basepoint is X,Y and whose dimensions are WX, WY. It is drawn according to the selected StrokeType. If don't use the verson with StrokeType, you need to call path/2 to stroke the path.

restore_state/1

restore_state(PDF::pdf()) -> ok

Restores the graphics state off the graphics state stack.

rotate/2

rotate(PDF::pdf(), Angle::number()) -> ok

Uses the angle given to rotate the graphics coordinate space. Usually you save_state before and restore_state afterwards.

round_rect/4

round_rect(PDF::pdf(), P::{X::number(), Y::number()}, S::{W::number(), H::number()}, Radius::number()) -> ok

Draws a rounded rectangle path. Its base is at X,Y and it has a size of W by H. The corner radius is Radius.

round_top_rect/4

round_top_rect(PDF::pdf(), P::{X::number(), Y::number()}, S::{W::number(), H::number()}, Radius::number()) -> ok

Draws a rounded rectangle path with only the top corners rounded. Its base is at X,Y and it has a size of W by H. The corner radius is Radius.

save_state/1

save_state(PDF::pdf()) -> ok

Saves the graphics state on the graphics state stack.

scale/3

scale(PDF::pdf(), ScaleX::number(), ScaleY::number()) -> ok

Changes the size of the text object in the X and Y directions.

set_author/2

set_author(PDF::pdf(), Author::pdf_string()) -> ok

Sets the Author atribute of the PDF.

set_dash/2

set_dash(PDF::pdf(), Mode::dash()) -> ok

Selects the stroke style for lines. Use one of the predefined styles or use a list of numbers for a custom pattern.

set_date/4

set_date(PDF::pdf(), Year::integer(), Month::integer(), Day::integer()) -> ok

Sets the Date atribute of the PDF.

set_fill_color/2

set_fill_color(PDF::pdf(), Color::color()) -> ok

Sets the fill color. Use RGB tuple or named color - full list in eg_pdf_op.

set_fill_color_RGB/4

set_fill_color_RGB(PDF::pdf(), R::number(), G::number(), B::number()) -> ok

Sets the fill color to use by subsequent functions. R, G, B are 0 .. 1

set_fill_gray/2

set_fill_gray(PDF::pdf(), Gray::number()) -> ok

Sets the fill color of as gray. 0.0 = Black, 1.0 = White.

set_font/3

set_font(PDF::pdf(), Fontname::pdf_string(), Size::number()) -> ok

Sets the font and the font size to be used by subsequent functions.

set_keywords/2

set_keywords(PDF::pdf(), Keywords::pdf_string()) -> ok

Sets the Keyword attribute of the PDF. Keywords should be a string containing keywords separated by commas.

set_line_cap/2

set_line_cap(PDF::pdf(), Mode::line_cap()) -> ok

Controls the ends of open subpaths and dashes in subsequent functions.

set_line_join/2

set_line_join(PDF::pdf(), Mode::line_join()) -> ok

Controls shape of connections of consecutive segments of a path.

set_line_width/2

set_line_width(PDF::pdf(), W::number()) -> ok

Sets the line width for subsequent functions.

set_page/2

set_page(PDF::pdf(), PageNo::integer()) -> ok

Goes to a page already created.

set_pagesize/2

set_pagesize(PDF::pdf(), Size::pagesize()) -> ok

Sets the page size. Popular formats are represented as atoms like a4 or letter.

set_pagesize/3

set_pagesize(PDF::pdf(), Width::pos_integer(), Height::pos_integer()) -> ok

Sets the page size with explicit width and height.

set_stroke_color/2

set_stroke_color(PDF::pdf(), Color::color()) -> ok

Sets the stroke color. Use RGB tuple or named color - full list in eg_pdf_op.

set_stroke_color_RGB/4

set_stroke_color_RGB(PDF::pdf(), R::number(), G::number(), B::number()) -> ok

Sets the stroke color to use by subsequent functions. R, G, B are 0 .. 1

set_stroke_gray/2

set_stroke_gray(PDF::pdf(), Gray::number()) -> ok

Sets the stroke color of as gray. 0.0 = Black, 1.0 = White.

set_subject/2

set_subject(PDF::pdf(), Subject::pdf_string()) -> ok

Sets the Subject atribute of the PDF.

set_text_leading/2

set_text_leading(PDF::pdf(), L::number()) -> ok

Sets the distance between the baselines of adjacent lines of text.

set_text_pos/3

set_text_pos(PDF::pdf(), X::number(), Y::number()) -> ok

Sets the start position to begin painting text.

set_text_rendering/2

set_text_rendering(PDF::pdf(), Mode::text_rendering()) -> ok

Sets the text rendering mode parameter. This determines whether showing text causes the glyph outlines to be stroked, filled, used a a clipping boundary or a combination of the previous.

set_text_rise/2

set_text_rise(PDF, Rise) -> any()

Raises or lowers the baseline for the following text.

set_text_scale/2

set_text_scale(PDF::pdf(), Scale::pos_integer()) -> ok

Sets the horizontal scaling of the following glyphs. Scale is percentage, 100 is normal. 50 makes them half as wide.

set_title/2

set_title(PDF::pdf(), Title::pdf_string()) -> ok

Sets the Title attribute of the PDF.

skew/3

skew(PDF::pdf(), XScewAngle::number(), YScewAngle::number()) -> ok

Changes the X,Y cordinate directions from 0 degrees for X and 90 for Y. This might be used to make letters look italic.

text/2

text(PDF::pdf(), String::pdf_string()) -> ok

Inserts the content of the String into PDF. It uses the graphics state and font information set at the time.

text_rotate/2

text_rotate(PDF::pdf(), Angle::number()) -> ok

Uses the angle given to rotate the text coordinate space. Usually you save_state before and restore_state afterward.

text_rotate_position/4

text_rotate_position(PDF::pdf(), X::number(), Y::number(), Angle::number()) -> ok

Uses the angle given to rotate the text coordinate space. Usually you save_state before and restore_state afterward.

text_transform/7

text_transform(PDF::pdf(), A::number(), B::number(), C::number(), D::number(), E::number(), F::number()) -> ok

Allows for any linear transformation for text. You can "translate", "rotate", "scale" and "skew" all in one step.

textbr/2

textbr(PDF::pdf(), String::pdf_string()) -> ok

Inserts the content of the String into PDF and starts new line. It uses the graphics state and font information set at the time.

transform/7

transform(PDF::pdf(), A::number(), B::number(), C::number(), D::number(), E::number(), F::number()) -> ok

Allows for any linear transformation for graphics. You can "translate", "rotate", "scale" and "skew" all in one step.

translate/3

translate(PDF::pdf(), X::number(), Y::number()) -> ok

Translates the origin of the coordinate system.


Generated by EDoc