libcrn
3.9.5
A document image processing library
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
libcrn
CRNUtils
CRNPDF.h
Go to the documentation of this file.
1
/* Copyright 2011 CoReNum
2
*
3
* This file is part of libcrn.
4
*
5
* libcrn is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Lesser General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* libcrn is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with libcrn. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* file: CRNPDF.h
19
* \author Yann LEYDIER
20
*/
21
22
#ifndef CRNPDF_HEADER
23
#define CRNPDF_HEADER
24
25
#include <CRN.h>
26
#ifdef CRN_USING_HARU
27
#include <
CRNImage/CRNPixel.h
>
28
#include <
CRNUtils/CRNPDFAttributes.h
>
29
30
namespace
crn
31
{
32
class
Path;
33
class
Rect;
34
45
namespace
PDF
46
{
47
class
Page;
48
class
Image;
49
59
class
Doc
60
{
61
public
:
63
Doc();
65
Doc(
const
Attributes &attr);
67
~Doc();
68
70
Doc(
const
Doc&) =
delete
;
72
Doc& operator=(
const
Doc&) =
delete
;
74
Doc(Doc&&) =
delete
;
76
Doc& operator=(Doc&&) =
delete
;
77
79
void
Save(
const
Path &file_name);
80
82
void
SetPageLayout(
Attributes::Layout
layout);
84
Attributes::Layout
GetPageLayout()
const
;
85
87
Page GetCurrentPage();
89
Page AddPage();
91
Page InsertPage(
const
Page& target);
92
94
Image AddJPEG(
const
Path &fname);
96
Image AddPNG(
const
Path &fname,
bool
delay =
true
);
97
99
void
SetAuthor(
const
StringUTF8 &s);
101
void
SetCreator(
const
StringUTF8 &s);
103
void
SetTitle(
const
StringUTF8 &s);
105
void
SetSubject(
const
StringUTF8 &s);
107
void
SetKeywords(
const
StringUTF8 &s);
108
110
void
SetPasswords(
const
StringUTF8 &admin,
const
StringUTF8 &user =
""
);
112
void
SetPermissions(
bool
can_copy,
bool
can_print);
113
115
void
SetAttributes(
const
Attributes &attr);
116
117
private
:
118
void
*doc;
119
bool
has_pass;
120
};
121
131
class
Image
132
{
133
public
:
135
Image():img(nullptr) { }
137
size_t
GetWidth()
const
;
139
size_t
GetHeight()
const
;
140
141
private
:
143
Image(
void
*obj);
144
void
*img;
145
friend
class
Doc;
146
friend
class
Page;
147
};
148
158
class
Page
159
{
160
public
:
162
Page():page(nullptr) { }
163
165
double
GetWidth();
167
double
GetHeight();
169
void
SetWidth(
double
w);
171
void
SetHeight(
double
h);
172
174
void
DrawImage(Image &img,
const
Rect &bbox);
175
177
void
SetPenColor(
const
crn::pixel::RGB8
&color);
179
void
SetFillColor(
const
crn::pixel::RGB8
&color);
181
void
DrawLine(
double
x1,
double
y1,
double
x2,
double
y2);
183
void
DrawRect(
const
Rect &rect,
bool
fill =
false
);
184
185
private
:
187
Page(
void
*obj);
188
void
*page;
189
friend
class
Doc;
190
};
191
}
192
}
193
194
#endif // CRN_USING_HARU
195
196
#endif
197
198
crn::pixel::RGB
Definition:
CRNPixel.h:55
CRNPixel.h
crn::PDF::Attributes::Layout
Layout
Definition:
CRNPDFAttributes.h:43
CRNPDFAttributes.h
Generated on Thu Sep 7 2017 13:54:26 for libcrn by
1.8.6