Invoice++
Loading...
Searching...
No Matches
pdf_utils.h File Reference
#include <hpdf.h>
#include <iostream>
#include <string>
#include "pdf_exception.h"
#include "../utils.h"
Include dependency graph for pdf_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void error_handler (const HPDF_STATUS error_no, const HPDF_STATUS detail_no, void *user_data)
 libharu error handler
 
HPDF_REAL calculate_text_height (const HPDF_Page page, const std::string &text, const HPDF_REAL max_width, const HPDF_REAL line_height, const HPDF_REAL max_lines=NULL)
 calculates the height of a given text on the pdf
 
HPDF_REAL writeText (const HPDF_Page page, std::string text, const HPDF_REAL left, const HPDF_REAL top, const HPDF_REAL line_height, const HPDF_REAL max_width, const _HPDF_TextAlignment alignment, const HPDF_REAL max_height)
 write text on to the pdf at a given point
 
HPDF_REAL writeTextIfNotHeightExceeded (const HPDF_Page page, std::string text, const HPDF_REAL left, const HPDF_REAL top, const HPDF_REAL line_height, const HPDF_REAL max_width, const _HPDF_TextAlignment alignment, const HPDF_REAL max_height)
 write text on to the pdf at a given point when max height is not exceeded
 
HPDF_REAL writeText (const HPDF_Page page, std::string text, const HPDF_REAL left, const HPDF_REAL top, const HPDF_REAL line_height, const HPDF_REAL max_width, const _HPDF_TextAlignment alignment, const int max_lines=0)
 write text on to the pdf at a given point
 
HPDF_REAL writeTextIfNotLinesExceeded (const HPDF_Page page, std::string text, const HPDF_REAL left, const HPDF_REAL top, const HPDF_REAL line_height, const HPDF_REAL max_width, const _HPDF_TextAlignment alignment, const int max_lines=0)
 write text on to the pdf at a given point when max lines is not exceeded
 
HPDF_REAL changeFont (const HPDF_Page page, const HPDF_REAL font_size, const HPDF_Font font)
 change the font and font size
 
void drawLine (const HPDF_Page page, const HPDF_REAL from_x, const HPDF_REAL from_y, const HPDF_REAL to_x, const HPDF_REAL to_y)
 draw a line, line width needs to be set before
 

Function Documentation

◆ calculate_text_height()

HPDF_REAL calculate_text_height ( const HPDF_Page page,
const std::string & text,
const HPDF_REAL max_width,
const HPDF_REAL line_height,
const HPDF_REAL max_lines = NULL )
inline

calculates the height of a given text on the pdf

Returns
height of the given text
Here is the caller graph for this function:

◆ changeFont()

HPDF_REAL changeFont ( const HPDF_Page page,
const HPDF_REAL font_size,
const HPDF_Font font )
inline

change the font and font size

Returns
line height
Here is the caller graph for this function:

◆ drawLine()

void drawLine ( const HPDF_Page page,
const HPDF_REAL from_x,
const HPDF_REAL from_y,
const HPDF_REAL to_x,
const HPDF_REAL to_y )
inline

draw a line, line width needs to be set before

Here is the caller graph for this function:

◆ error_handler()

void error_handler ( const HPDF_STATUS error_no,
const HPDF_STATUS detail_no,
void * user_data )
inline

libharu error handler

Exceptions
PDFException
Here is the caller graph for this function:

◆ writeText() [1/2]

HPDF_REAL writeText ( const HPDF_Page page,
std::string text,
const HPDF_REAL left,
const HPDF_REAL top,
const HPDF_REAL line_height,
const HPDF_REAL max_width,
const _HPDF_TextAlignment alignment,
const HPDF_REAL max_height )
inline

write text on to the pdf at a given point

Returns
the height of this element on the pdf
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeText() [2/2]

HPDF_REAL writeText ( const HPDF_Page page,
std::string text,
const HPDF_REAL left,
const HPDF_REAL top,
const HPDF_REAL line_height,
const HPDF_REAL max_width,
const _HPDF_TextAlignment alignment,
const int max_lines = 0 )
inline

write text on to the pdf at a given point

Returns
the height of this element on the pdf
Here is the call graph for this function:

◆ writeTextIfNotHeightExceeded()

HPDF_REAL writeTextIfNotHeightExceeded ( const HPDF_Page page,
std::string text,
const HPDF_REAL left,
const HPDF_REAL top,
const HPDF_REAL line_height,
const HPDF_REAL max_width,
const _HPDF_TextAlignment alignment,
const HPDF_REAL max_height )
inline

write text on to the pdf at a given point when max height is not exceeded

Returns
the height of this element on the pdf, 0 when max height is exceeded
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeTextIfNotLinesExceeded()

HPDF_REAL writeTextIfNotLinesExceeded ( const HPDF_Page page,
std::string text,
const HPDF_REAL left,
const HPDF_REAL top,
const HPDF_REAL line_height,
const HPDF_REAL max_width,
const _HPDF_TextAlignment alignment,
const int max_lines = 0 )
inline

write text on to the pdf at a given point when max lines is not exceeded

Returns
the height of this element on the pdf, 0 when max lines is exceeded
Here is the call graph for this function: