MeshLib C++ Docs
Loading...
Searching...
No Matches

#include <MRIOExtras/MRPdf.h>

Classes

struct  Cell
struct  CellCustomParams
struct  ImageParams
 Parameters to adding image from file. More...
struct  PaletteRowStats
struct  TextCellParams
struct  TextParams
 parameters to drawing text More...

Public Types

enum class  AlignmentHorizontal { AlignmentHorizontal::Left , AlignmentHorizontal::Center , AlignmentHorizontal::Right }
using TableCustomRule = std::function<CellCustomParams( int row, int column, const std::string& cellValueText)>

Public Member Functions

 Pdf (const PdfParameters &params=PdfParameters())
 Ctor. Create a document, but not a page. To create a new page use newPage() method.
 Pdf (Pdf &&other) noexcept
Pdfoperator= (Pdf other) noexcept
 ~Pdf ()
 Dtor.
void addText (const std::string &text, bool isTitle=false)
void addText (const std::string &text, const TextParams &params)
float getTextWidth (const std::string &text, const TextParams &params)
 return text width
void addTable (const std::vector< std::pair< std::string, float > > &table)
void addPaletteStatsTable (const std::vector< PaletteRowStats > &paletteStats)
void addImageFromFile (const std::filesystem::path &imagePath, const ImageParams &params)
 Add image from file in current cursor position. If image bigger than page size, autoscale image to page size. Move cursor.
void addImage (const Image &image, const ImageParams &params)
void newPage ()
 Add new pageand move cursor on it.
void setNewPageAction (std::function< void(Pdf &)> action)
 set function to customize new page after creation
void saveToFile (const std::filesystem::path &documentPath)
 Save document to file.
void setCursorPosX (float posX)
void setCursorPosY (float posY)
float getCursorPosX () const
float getCursorPosY () const
Vector2f getPageSize () const
Box2f getPageWorkArea () const
 operator bool () const
 Checking the ability to work with a document.
void newTable (int columnCount)
 set up new table (clear table customization, reset parameters to default values)
Expected< void > setTableColumnWidths (const std::vector< float > &widths)
 set table column widths
Expected< void > addTableTitles (const std::vector< std::string > &titles)
 add in pdf table row with titles
Expected< void > setColumnValuesFormat (const std::vector< std::string > &formats)
 set format for conversion values to string for each column
Expected< void > addRow (const std::vector< Cell > &cells)
 add in pdf table row with values
float getTableTextWidth (const std::string &text)
void setTableCustomRule (TableCustomRule rule)
 add rule to customize table cells
void drawTextInRect (const std::string &text, const Box2f &rect, const TextParams &params)
 basic drawing methods without automatic cursor position control
void drawTextCell (const std::string &text, const TextCellParams &params)
void drawRect (const Box2f &rect, const Color &fillColor, const Color &strokeColor)
 draw rect (filled with border)

Detailed Description

Class for simple creation pdf.


The documentation for this class was generated from the following file: