niteshade.postprocessing.PDF
- class niteshade.postprocessing.PDF(orientation='P', unit='mm', format='A4')
Bases:
fpdf.fpdf.FPDF
- __init__(orientation='P', unit='mm', format='A4')
Methods
__init__
([orientation, unit, format])accept_page_break
()Accept automatic page break or not
add_all_charts_from_directory
(dir_path[, ...])Add all jpg / png / jpeg to a pdf from a directory.
add_chart
(file_path[, chart_title, new_page])Add a jpg / png / jpeg to a pdf.
add_font
(family[, style, fname, uni])Add a TrueType or Type1 font
add_link
()Create a new internal link
add_page
([orientation])Start a new page
add_table
(df[, table_title, new_page])Add a table to the pdf.
alias_nb_pages
([alias])Define an alias for total number of pages
cell
(w[, h, txt, border, ln, align, fill, link])Output a cell
check_page
()Decorator to protect drawing methods
close
()Terminate document
code39
(txt, x, y[, w, h])Barcode 3of9
dashed_line
(x1, y1, x2, y2[, dash_length, ...])Draw a dashed line.
ellipse
(x, y, w, h[, style])Draw a ellipse
error
(msg)Fatal error
footer
()Footer to be implemented in your own inherited class
get_string_width
(s)Get width of a string in the current font
get_x
()Get x position
get_y
()Get y position
header
()Header to be implemented in your own inherited class
image
(name[, x, y, w, h, type, link])Put an image on the page
interleaved2of5
(txt, x, y[, w, h])Barcode I2of5 (numeric), adds a 0 if odd lenght
line
(x1, y1, x2, y2)Draw a line
link
(x, y, w, h, link)Put a link on the page
ln
([h])Line Feed; default value is last cell height
multi_cell
(w, h[, txt, border, align, fill, ...])Output text with automatic or explicit line breaks
normalize_text
(txt)Check that text input is in the correct format/encoding
open
()Begin document
output
([name, dest])Output PDF to some destination
page_no
()Get current page number
rect
(x, y, w, h[, style])Draw a rectangle
rotate
(angle[, x, y])set_author
(author)Author of document
set_auto_page_break
(auto[, margin])Set auto page break mode and triggering margin
set_compression
(compress)Set page compression
set_creator
(creator)Creator of document
set_display_mode
(zoom[, layout])Set display mode in viewer
set_draw_color
(r[, g, b])Set color for all stroking operations
set_fill_color
(r[, g, b])Set color for all filling operations
set_font
(family[, style, size])Select a font; size given in points
set_font_size
(size)Set font size in points
set_keywords
(keywords)Keywords of document
set_left_margin
(margin)Set left margin
set_line_width
(width)Set line width
set_link
(link[, y, page])Set destination of internal link
set_margins
(left, top[, right])Set left, top and right margins
set_right_margin
(margin)Set right margin
set_subject
(subject)Subject of document
set_text_color
(r[, g, b])Set color for text
set_title
(title)Title of document
set_top_margin
(margin)Set top margin
set_x
(x)Set x position
set_xy
(x, y)Set x and y positions
set_y
(y)Set y position and reset x
text
(x, y[, txt])Output a string
write
(h[, txt, link])Output text in flowing mode
- add_all_charts_from_directory(dir_path, new_page=True)
Add all jpg / png / jpeg to a pdf from a directory. :param dir_path: directory path. :type dir_path: str :param new_page: print table on a new page. :type new_page: bool
- add_chart(file_path, chart_title=None, new_page=True)
Add a jpg / png / jpeg to a pdf. :param file_path: file path. :type file_path: str :param chart_title: title as necessary. :type chart_title: str :param new_page: print table on a new page. :type new_page: bool
- add_table(df, table_title=None, new_page=True)
Add a table to the pdf. :param df: pandas data frame. :type df: pd.core.frame.DataFrame :param table_title: title as necessary. :type table_title: str :param new_page: print table on a new page. :type new_page: bool
Footer to be implemented in your own inherited class
- header()
Header to be implemented in your own inherited class