MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::Pdf Class Reference

#include <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

MRIOEXTRAS_API Pdf (const PdfParameters &params=PdfParameters())
 Ctor. Create a document, but not a page. To create a new page use newPage() method.
 
MRIOEXTRAS_API Pdf (Pdf &&other) noexcept
 
MRIOEXTRAS_API Pdfoperator= (Pdf other) noexcept
 
MRIOEXTRAS_API ~Pdf ()
 Dtor.
 
MRIOEXTRAS_API void addText (const std::string &text, bool isTitle=false)
 
MRIOEXTRAS_API void addText (const std::string &text, const TextParams &params)
 
MRIOEXTRAS_API float getTextWidth (const std::string &text, const TextParams &params)
 return text width
 
MRIOEXTRAS_API void addTable (const std::vector< std::pair< std::string, float > > &table)
 
MRIOEXTRAS_API void addPaletteStatsTable (const std::vector< PaletteRowStats > &paletteStats)
 
MRIOEXTRAS_API 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.
 
MRIOEXTRAS_API void addImage (const Image &image, const ImageParams &params)
 
MRIOEXTRAS_API void newPage ()
 Add new pageand move cursor on it.
 
void setNewPageAction (std::function< void(Pdf &)> action)
 set function to customize new page after creation
 
MRIOEXTRAS_API 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
 
MRIOEXTRAS_API Vector2f getPageSize () const
 
MRIOEXTRAS_API Box2f getPageWorkArea () const
 
MRIOEXTRAS_API operator bool () const
 Checking the ability to work with a document.
 
MRIOEXTRAS_API void newTable (int columnCount)
 set up new table (clear table customization, reset parameters to default values)
 
MRIOEXTRAS_API Expected< void > setTableColumnWidths (const std::vector< float > &widths)
 set table column widths
 
MRIOEXTRAS_API Expected< void > addTableTitles (const std::vector< std::string > &titles)
 add in pdf table row with titles
 
MRIOEXTRAS_API Expected< void > setColumnValuesFormat (const std::vector< std::string > &formats)
 set format for conversion values to string for each column
 
MRIOEXTRAS_API Expected< void > addRow (const std::vector< Cell > &cells)
 add in pdf table row with values
 
MRIOEXTRAS_API float getTableTextWidth (const std::string &text)
 
void setTableCustomRule (TableCustomRule rule)
 add rule to customize table cells
 
MRIOEXTRAS_API void drawTextInRect (const std::string &text, const Box2f &rect, const TextParams &params)
 basic drawing methods without automatic cursor position control
 
MRIOEXTRAS_API void drawTextCell (const std::string &text, const TextCellParams &params)
 
MRIOEXTRAS_API 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: