36
36
#include "ipepage.h"
37
37
#include "ipedoc.h"
38
38
#include "ipeimage.h"
42
// --------------------------------------------------------------------
44
class IpePdfPainter : public IpePainter {
46
IpePdfPainter(const IpeStyleSheet *style, IpeStream &stream);
47
virtual ~IpePdfPainter() { }
49
virtual void Rect(const IpeRect &re);
52
virtual void DoPush();
54
virtual void DoNewPath();
55
virtual void DoMoveTo(const IpeVector &v);
56
virtual void DoLineTo(const IpeVector &v);
57
virtual void DoCurveTo(const IpeVector &v1, const IpeVector &v2,
59
virtual void DoClosePath();
60
virtual void DoDrawPath();
61
virtual void DoDrawBitmap(IpeBitmap bitmap);
62
virtual void DoDrawText(const IpeText *text);
65
void DrawColor(IpeStream &stream, IpeAttribute color,
66
const char *gray, const char *rgb);
67
void DrawAttributes();
71
// iActiveState records the attribute settings that have been
72
// recorded in the PDF output, to avoid repeating them
73
// over and over again.
74
StateSeq iActiveState;
77
// --------------------------------------------------------------------
81
IpePdfWriter(IpeTellStream &stream, const IpeDocument *doc,
82
bool noShading, bool lastView,
83
int fromPage, int toPage, int compression);
86
void EmbedFonts(const IpeFontPool *pool);
88
void CreateBookmarks();
89
void CreateXmlStream(IpeString xmldata, bool preCompressed);
90
void CreateTrailer(IpeString creator);
93
void CreatePageView(int page, int view);
94
int StartObject(int objnum = -1);
95
void CreateStream(const char *data, int size, bool preCompressed);
96
void WriteString(IpeString text);
97
void EmbedBitmap(IpeBitmap bitmap);
98
IpeRect PaintView(IpeStream &stream, int pno, int view);
101
IpeTellStream &iStream;
102
const IpeDocument *iDoc;
103
//! Save only last view of each page?
105
//! Obj id of XML stream.
107
//! Obj id of font resource dictionary.
109
//! Obj id of shading dictionary.
111
//! Obj id of outline dictionary.
113
//! Compression level (0..9).
115
//! Obj id of font for page numbers.
117
// Export only those pages
121
std::vector<IpeBitmap> iBitmaps;
122
//! Next unused PDF object number.
124
//! List of pages, expressed as Pdf object numbers.
125
std::vector<int> iPageObjectNumbers;
126
//! List of file locations, in object number order (starting with 0).
127
std::map<int, long> iXref;
39
#include "ipefontpool.h"
41
// --------------------------------------------------------------------
45
class PdfPainter : public Painter {
47
PdfPainter(const Cascade *style, Stream &stream);
48
virtual ~PdfPainter() { }
50
static void drawColor(Stream &stream, Color color,
51
const char *gray, const char *rgb);
54
virtual void doPush();
56
virtual void doNewPath();
57
virtual void doMoveTo(const Vector &v);
58
virtual void doLineTo(const Vector &v);
59
virtual void doCurveTo(const Vector &v1, const Vector &v2,
61
virtual void doClosePath();
62
virtual void doDrawPath(TPathMode mode);
63
virtual void doDrawBitmap(Bitmap bitmap);
64
virtual void doDrawText(const Text *text);
65
virtual void doAddClipPath();
66
virtual void doDrawSymbol(Attribute symbol);
69
void drawAttributes();
74
// iActiveState records the attribute settings that have been
75
// recorded in the PDF output, to avoid repeating them
76
// over and over again.
77
std::list<State> iActiveState;
80
// --------------------------------------------------------------------
84
PdfWriter(TellStream &stream, const Document *doc,
86
bool lastView, int fromPage, int toPage, int compression);
90
void createPageView(int page, int view);
91
void createBookmarks();
92
void createXmlStream(String xmldata, bool preCompressed);
96
int startObject(int objnum = -1);
97
void createStream(const char *data, int size, bool preCompressed);
98
void writeString(String text);
99
void embedBitmap(Bitmap bitmap);
100
void paintView(Stream &stream, int pno, int view);
101
void embedBitmaps(const BitmapFinder &bm);
102
void createResources(const BitmapFinder &bm);
103
void embedFonts(const FontPool *pool);
107
const Document *iDoc;
108
//! Show only last view of each page?
110
//! Obj id of XML stream.
112
//! Obj id of font resource dictionary.
114
//! Obj id of outline dictionary.
116
//! Compression level (0..9).
118
//! Obj id of font for page numbers.
120
//! Obj id of GState with opacity definitions.
122
//! Obj id of dictionary with pattern definitions.
124
// Export only those pages
128
std::vector<Bitmap> iBitmaps;
129
//! Next unused PDF object number.
132
//! Object numbers of gradients, indexed by attribute name
133
std::map<int, int> iGradients;
134
//! Object numbers of symbols, indexed by attribute name
135
std::map<int, int> iSymbols;
136
//! List of pages, expressed as Pdf object numbers.
137
std::vector<int> iPageObjectNumbers;
138
//! List of file locations, in object number order (starting with 0).
139
std::map<int, long> iXref;
130
144
// --------------------------------------------------------------------