-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf-writer.h
63 lines (57 loc) · 2.2 KB
/
pdf-writer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* pdf-writer.h
*
* Created on: Oct 31, 2017
* Author: gnat
*/
#ifndef PDF_WRITER_H_
#define PDF_WRITER_H_
#include <phpcpp.h>
#include <PDFWriter/PDFWriter.h>
#include <PDFWriter/PDFModifiedPage.h>
#include <PDFWriter/PDFPage.h>
#include <PDFWriter/PDFObject.h>
#include <PDFWriter/AbstractContentContext.h>
#include <unordered_map>
#include "pdf-image.h"
#include "pdf-text.h"
#include "pdf-rectangle.h"
#include "pdf-line.h"
void initializeFonts();
std::vector<std::string> getFonts();
Php::Value fonts();
class PdfWriter : public Php::Base {
private:
PDFWriter writer;
PDFModifiedPage * modifiedPage = NULL;
PDFObject * page;// = NULL;
AbstractContentContext * contentContext;// = NULL;
AbstractContentContext::TextOptions * textOptions;// = NULL;
std::string defaultFontName;
PDFUsedFont * defaultFont;// = NULL;
AbstractContentContext::TextOptions * defaultText;// = NULL;
int64_t pageNum = -1;
AbstractContentContext::TextOptions * getFont(std::string requestedFont, double inFontSize = 10, int64_t color = 0);
std::string _inputFileName;
std::string _outputFileName;
std::unordered_map<double,std::vector<PdfImage*>> pageImages;
std::unordered_map<double,std::vector<PdfText*>> pageText;
std::unordered_map<double,std::vector<PdfRectangle*>> pageRectangles;
std::unordered_map<double,std::vector<PdfLine*>> pageLines;
void writeText(PdfText *obj, int pageRotation, const PDFRectangle &mediaBox, AbstractContentContext *contentContext);
void writeImage(PdfImage *image, AbstractContentContext *contentContext);
void writeRectangle(PdfRectangle *rect, AbstractContentContext *contentContext);
void writeLine(PdfLine *line, AbstractContentContext *contentContext);
public:
PdfWriter();
void __construct(Php::Parameters ¶ms);
void writeTextToPage(Php::Parameters ¶ms);
void drawRectangleToPage(Php::Parameters ¶ms);
void drawLineToPage(Php::Parameters ¶ms);
void writeImageToPage(Php::Parameters ¶ms);
void writePdf(Php::Parameters ¶ms);
void setFont(Php::Parameters ¶ms);
Php::Value getAllFonts();
static Php::Value combine(Php::Parameters ¶ms);
};
#endif /* PDF_WRITER_H_ */