#include <MRPdf.h>
Classes | |
struct | Cell |
struct | CellCustomParams |
struct | ImageParams |
Parameters to adding image from file. More... | |
struct | PaletteRowStats |
struct | TextCellParams |
struct | TextParams |
Public Types | |
enum class | AlignmentHorizontal { Left , Center , Right } |
using | TableCustomRule = std::function<CellCustomParams( int row, int column, const std::string& cellValueText)> |
Public Member Functions | |
MRIOEXTRAS_API | Pdf (const PdfParameters ¶ms=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 Pdf & | operator= (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 ¶ms) |
MRIOEXTRAS_API float | getTextWidth (const std::string &text, const TextParams ¶ms) |
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 ¶ms) |
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 ¶ms) |
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) |
MRIOEXTRAS_API Expected< void > | setTableColumnWidths (const std::vector< float > &widths) |
MRIOEXTRAS_API Expected< void > | addTableTitles (const std::vector< std::string > &titles) |
MRIOEXTRAS_API Expected< void > | setColumnValuesFormat (const std::vector< std::string > &formats) |
MRIOEXTRAS_API Expected< void > | addRow (const std::vector< Cell > &cells) |
MRIOEXTRAS_API float | getTableTextWidth (const std::string &text) |
void | setTableCustomRule (TableCustomRule rule) |
MRIOEXTRAS_API void | drawTextInRect (const std::string &text, const Box2f &rect, const TextParams ¶ms) |
MRIOEXTRAS_API void | drawTextCell (const std::string &text, const TextCellParams ¶ms) |
Class for simple creation pdf.
using MR::Pdf::TableCustomRule = std::function<CellCustomParams( int row, int column, const std::string& cellValueText)> |
|
strong |
MRIOEXTRAS_API MR::Pdf::Pdf | ( | const PdfParameters & | params = PdfParameters() | ) |
Ctor. Create a document, but not a page. To create a new page use newPage() method.
|
noexcept |
MRIOEXTRAS_API MR::Pdf::~Pdf | ( | ) |
Dtor.
MRIOEXTRAS_API void MR::Pdf::addImage | ( | const Image & | image, |
const ImageParams & | params ) |
MRIOEXTRAS_API void MR::Pdf::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 MR::Pdf::addPaletteStatsTable | ( | const std::vector< PaletteRowStats > & | paletteStats | ) |
MRIOEXTRAS_API void MR::Pdf::addTable | ( | const std::vector< std::pair< std::string, float > > & | table | ) |
MRIOEXTRAS_API Expected< void > MR::Pdf::addTableTitles | ( | const std::vector< std::string > & | titles | ) |
MRIOEXTRAS_API void MR::Pdf::addText | ( | const std::string & | text, |
bool | isTitle = false ) |
MRIOEXTRAS_API void MR::Pdf::addText | ( | const std::string & | text, |
const TextParams & | params ) |
MRIOEXTRAS_API void MR::Pdf::drawTextCell | ( | const std::string & | text, |
const TextCellParams & | params ) |
MRIOEXTRAS_API void MR::Pdf::drawTextInRect | ( | const std::string & | text, |
const Box2f & | rect, | ||
const TextParams & | params ) |
|
inline |
|
inline |
MRIOEXTRAS_API Vector2f MR::Pdf::getPageSize | ( | ) | const |
MRIOEXTRAS_API Box2f MR::Pdf::getPageWorkArea | ( | ) | const |
MRIOEXTRAS_API float MR::Pdf::getTableTextWidth | ( | const std::string & | text | ) |
MRIOEXTRAS_API float MR::Pdf::getTextWidth | ( | const std::string & | text, |
const TextParams & | params ) |
return text width
MRIOEXTRAS_API void MR::Pdf::newPage | ( | ) |
Add new pageand move cursor on it.
MRIOEXTRAS_API void MR::Pdf::newTable | ( | int | columnCount | ) |
MRIOEXTRAS_API MR::Pdf::operator bool | ( | ) | const |
Checking the ability to work with a document.
MRIOEXTRAS_API void MR::Pdf::saveToFile | ( | const std::filesystem::path & | documentPath | ) |
Save document to file.
MRIOEXTRAS_API Expected< void > MR::Pdf::setColumnValuesFormat | ( | const std::vector< std::string > & | formats | ) |
|
inline |
|
inline |
|
inline |
set function to customize new page after creation
MRIOEXTRAS_API Expected< void > MR::Pdf::setTableColumnWidths | ( | const std::vector< float > & | widths | ) |
|
inline |