| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef PDFTRANSLATOR_H |
| 7 |
#define PDFTRANSLATOR_H |
| 8 |
|
| 9 |
#include <podofo/podofo.h> |
| 10 |
#include "impositionplan.h" |
| 11 |
|
| 12 |
#include <string> |
| 13 |
#include <map> |
| 14 |
#include <set> |
| 15 |
#include <vector> |
| 16 |
#include <sstream> |
| 17 |
#include <istream> |
| 18 |
#include <string> |
| 19 |
|
| 20 |
namespace PoDoFo::Impose |
| 21 |
{ |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
class PdfTranslator |
| 38 |
{ |
| 39 |
public: |
| 40 |
PdfTranslator(); |
| 41 |
|
| 42 |
~PdfTranslator() { } |
| 43 |
|
| 44 |
PdfMemDocument* sourceDoc; |
| 45 |
PdfMemDocument* targetDoc; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
void setSource(const std::string& source); |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
void addToSource(const std::string& source); |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
void setTarget(const std::string& target); |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
void loadPlan(const std::string& planFile, PoDoFo::Impose::PlanReader loader); |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
void impose(); |
| 76 |
|
| 77 |
private: |
| 78 |
std::string inFilePath; |
| 79 |
std::string outFilePath; |
| 80 |
|
| 81 |
PdfReference globalResRef; |
| 82 |
|
| 83 |
ImpositionPlan* planImposition; |
| 84 |
|
| 85 |
std::map<int, PdfXObjectForm*> xobjects; |
| 86 |
std::map<int, PdfObject*> resources; |
| 87 |
std::map<int, Rect> cropRect; |
| 88 |
std::map<int, Rect> bleedRect; |
| 89 |
std::map<int, Rect> trimRect; |
| 90 |
std::map<int, Rect> artRect; |
| 91 |
std::map<int, PdfDictionary*> pDict; |
| 92 |
std::map<int, int> virtualMap; |
| 93 |
|
| 94 |
int duplicate; |
| 95 |
|
| 96 |
bool checkIsPDF(std::string path); |
| 97 |
PdfObject* getInheritedResources(PdfPage& page); |
| 98 |
void mergeResKey(PdfObject* base, PdfName key, PdfObject* tomerge); |
| 99 |
PdfObject* migrateResource(PdfObject* obj); |
| 100 |
void drawLine(double x, double y, double xx, double yy, std::ostringstream& a); |
| 101 |
void signature(double x, double y, int sheet, const std::vector<int>& pages, std::ostringstream& a); |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
int sortLoop(std::vector<std::string>& memfile, int numline); |
| 106 |
|
| 107 |
std::string useFont; |
| 108 |
PdfReference useFontRef; |
| 109 |
double extraSpace; |
| 110 |
|
| 111 |
std::vector<std::string> multiSource; |
| 112 |
|
| 113 |
std::map<std::string, PdfObject*> migrateMap; |
| 114 |
std::set<PdfObject*> setMigrationPending; |
| 115 |
|
| 116 |
std::vector<double> transformMatrix; |
| 117 |
void transform(double a, double b, double c, double d, double e, double f); |
| 118 |
void translate(double dx, double dy); |
| 119 |
void scale(double sx, double sy); |
| 120 |
void rotate(double theta); |
| 121 |
void rotate_and_translate(double theta, double dx, double dy); |
| 122 |
public: |
| 123 |
unsigned pageCount; |
| 124 |
double sourceWidth; |
| 125 |
double sourceHeight; |
| 126 |
double destWidth; |
| 127 |
double destHeight; |
| 128 |
double scaleFactor; |
| 129 |
std::string boundingBox; |
| 130 |
}; |
| 131 |
|
| 132 |
} |
| 133 |
|
| 134 |
#endif |