LibPdfFlow is a library used to write PDF files from a C program. The idea behind this library is, to generate PDF
files as simple as HTML files (e.g. reports) on an embedded device with restricted resources.The library is
written in C and uses only libc and libHaru a free, cross platform, open source library for
generating PDF files. LibPdfFlow has only a few features, but it is small and does not need a lot of resources like
latex or similar libraries.
License
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Installation
Install libharu and type make.
Examples
Hello World
Writes "Hello World" emphasized to the file test.pdf:
The example simple (examples/simple) shows how to use the libpdfflow with a C programm.
mkd2pdf
The example mkd2pdf shows how to convert a markdown document into a PDF.
As markdown parser, libsoldout is used. This
markdown file converted with mkd2pdf is here.
LibPdfFlow
LibPdfFlow is a library used to write PDF files from a C program. The idea behind this library is, to generate PDF
files as simple as HTML files (e.g. reports) on an embedded device with restricted resources.The library is
written in C and uses only libc and libHaru a free, cross platform, open source library for
generating PDF files. LibPdfFlow has only a few features, but it is small and does not need a lot of resources like
latex or similar libraries.
License
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Installation
Install libharu and type make.
Examples
Hello World
Writes "Hello World" emphasized to the file test.pdf:
Simple
The example simple (examples/simple) shows how to use the libpdfflow with a C programm.
mkd2pdf
The example mkd2pdf shows how to convert a markdown document into a PDF.
As markdown parser, libsoldout is used. This
markdown file converted with mkd2pdf is here.
API
FPDF_doc_new()
Description
FPDF_doc_new() create an instance of a document object and initialize it.
Parameters
page_direction - Page direction. FPDF_PAGE_DIRECTION_PORTRAIT or FPDF_PAGE_DIRECTION_LANDSCAPE.
Return Value
FPDF_doc_new() return a handle of document object on success and NULL on failure.
See also
FPDF_doc_free()
FPDF_doc_free()
Description
FPDF_doc_free() revokes a document object and all resources.
Parameters
doc - The handle of a document object.
See also
FPDF_doc_new()
void FPDF_doc_save(FPDF_WRITER * doc, const char * filename);
FPDF_doc_save()
Description
Saves the document.
Parameters
doc - The handle of a document object.
filename - The name of the file to save.
FPDF_render()
Description
Renders the PDF file.
Parameters
doc - The handle of a document object.
FPDF_h_start()
Description
Start a header section. This function corresponds to the HTML tag h1-h4.
Parameters
doc - The handle of a document object.
level - Header level 1-4
See also
FPDF_h_end()
FPDF_h_end()
Description
End a haeder section. This function corresponds to the HTML tag /h1-/h4.
Parameters
doc - The handle of a document object.
See also
FPDF_h_start()
FPDF_em_start()
Description
Start a emphasized section. This function corresponds to the HTML tag em.
Parameters
doc - The handle of a document object.
See also
FPDF_em_end()
FPDF_em_end()
Description
End a emphasized section. This function corresponds to the HTML tag /em.
Parameters
doc - The handle of a document object.
See also
FPDF_em_start()
FPDF_strong_start()
Description
Start a important text section. This function corresponds to the HTML tag strong.
Parameters
doc - The handle of a document object.
See also
FPDF_strong_end()
FPDF_strong_end()
Description
End a important text section. This function corresponds to the HTML tag /strong.
Parameters
doc - The handle of a document object.
See also
FPDF_strong_start()
FPDF_code_start()
Description
Start a source code section. This function corresponds to the HTML tag code.
Parameters
doc - The handle of a document object.
See also
FPDF_code_end()
FPDF_code_end()
Description
End a source code section. This function corresponds to the HTML tag /code.
Parameters
doc - The handle of a document object.
See also
FPDF_code_start()
FPDF_link_start()
Description
Start a link section. This function corresponds to the HTML tag a.
Parameters
doc - The handle of a document object.
link - URL of destination to jump to.
type - Type of link (web, internal)
See also
FPDF_link_end(), FPDF_anchor()
FPDF_link_end()
Description
End a link section. This function corresponds to the HTML tag /a.
Parameters
doc - The handle of a document object.
See also
FPDF_link_start()
FPDF_list_start()
Description
Start a list. This function corresponds to the HTML tag ol or ul. To start a list item, use FPDF_listitem_start().
Parameters
doc - The handle of a document object.
style - One of the following values:
See also
FPDF_list_end()
FPDF_list_end()
Description
End a list. This function corresponds to the HTML tag \ol or \ul.
Parameters
doc - The handle of a document object.
See also
FPDF_list_start()
FPDF_listitem_start()
Description
Start a list item. This function corresponds to the HTML tag li.
Parameters
doc - The handle of a document object.
See also
FPDF_listitem_end()
FPDF_listitem_end()
Description
End a list item. This function corresponds to the HTML tag \li.
Parameters
doc - The handle of a document object.
See also
FPDF_listitem_start()
FPDF_blockquote_start()
Description
Start a inserted section. This function corresponds to the HTML tag blockquote.
Parameters
doc - The handle of a document object.
See also
FPDF_blockquote_end()
FPDF_blockquote_end()
Description
End a inserted section. This function corresponds to the HTML tag \blockquote.
Parameters
doc - The handle of a document object.
See also
FPDF_blockquote_start()
FPDF_paragraph_start()
Description
Start a paragraph. This function corresponds to the HTML tag p.
Parameters
doc - The handle of a document object.
See also
FPDF_paragraph_end()
FPDF_paragraph_end()
Description
End a paragraph. This function corresponds to the HTML tag /p.
Parameters
doc - The handle of a document object.
See also
FPDF_paragraph_start()
FPDF_pre_start()
Description
Start a pre formatted section. This function corresponds to the HTML tag pre.
Parameters
doc - The handle of a document object.
See also
FPDF_pre_end()
FPDF_pre_end()
Description
End a pre formatted section. This function corresponds to the HTML tag \pre.
Parameters
doc - The handle of a document object.
See also
FPDF_pre_start()
FPDF_out()
Description
Write some text into the PDF file.
Parameters
doc - The handle of a document object.
text - Text to be written.
FPDF_out2()
Description
Write some text into the PDF file.
Parameters
doc - The handle of a document object.
text - Text to be written.
length - Length of the text to be written.
FPDF_table_start()
Description
Start a table. This function corresponds to the HTML tag table.
Parameters
doc - The handle of a document object.
options - Pointer to a table option struct or NULL.
See also
FPDF_init_table_options()
See also
FPDF_table_end()
FPDF_table_end()
Description
End a table. This function corresponds to the HTML tag /table.
Parameters
doc - The handle of a document object.
See also
FPDF_table_start()
FPDF_table_row_start()
Description
Start a row. This function corresponds to the HTML tag tr.
Parameters
doc - The handle of a document object.
See also
FPDF_table_row_end()
FPDF_table_row_end()
Description
End a row. This function corresponds to the HTML tag /tr.
Parameters
doc - The handle of a document object.
See also
FPDF_table_row_start()
FPDF_table_cell_start()
Description
Start a cell. This function corresponds to the HTML tag td.
Parameters
doc - The handle of a document object.
options - Cell options or NULL.
See also
FPDF_table_cell_end()
FPDF_table_cell_end()
Description
Start a cell. This function corresponds to the HTML tag /td.
Parameters
doc - The handle of a document object.
See also
FPDF_table_cell_start()
FPDF_header()
Description
Add a titel and an image to each page. This function must be called after FPDF_render().
Parameters
doc - The handle of a document object.
titel - Document titel
image - Path to a PNG image or NULL.
FPDF_footer()
Description
Add a page numbers to each page. This function must be called after FPDF_render().
Parameters
doc - The handle of a document object.
FPDF_outline()
Description
Add an outline to the document.
Parameters
doc - The handle of a document object.
FPDF_init_table_options()
Description
This function returns a FPDF_TABLE_OPTIONS struct with default values.
FPDF_init_cell_options()
Description
This function returns a FPDF_CELL_OPTIONS struct with default values.
FPDF_anchor()
Description
Set at the current position an achor with the id id.
Parameters
doc - The handle of a document object.
id - Anchor id.
See also
FPDF_link_start()
Last edit: Daniel Zwirner 2014-04-04