Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
poppler
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oliver Sander
poppler
Commits
e64f6341
Commit
e64f6341
authored
Nov 21, 2005
by
Albert Astals Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PAtch to add some more functions to the qt binding by Stefan Kebekus
parent
8bd8cb41
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
1 deletion
+114
-1
ChangeLog
ChangeLog
+5
-0
qt/poppler-page.cc
qt/poppler-page.cc
+68
-1
qt/poppler-qt.h
qt/poppler-qt.h
+41
-0
No files found.
ChangeLog
View file @
e64f6341
2005-11-21 Albert Astals Cid <aacid@kde.org>
* qt/poppler-page.cc:
* qt/poppler-qt.h: Some more functions, patch by Stefan Kebekus
2005-11-21 Albert Astals Cid <aacid@kde.org>
* qt/Makefile.am: Fix build problems some people were having
...
...
qt/poppler-page.cc
View file @
e64f6341
...
...
@@ -156,6 +156,11 @@ Page::~Page()
}
void
Page
::
renderToPixmap
(
QPixmap
**
q
,
int
x
,
int
y
,
int
w
,
int
h
)
const
{
renderToPixmap
(
q
,
x
,
y
,
w
,
h
,
72.0
,
72.0
);
}
void
Page
::
renderToPixmap
(
QPixmap
**
q
,
int
x
,
int
y
,
int
w
,
int
h
,
double
xres
,
double
yres
)
const
{
SplashOutputDev
*
output_dev
;
SplashBitmap
*
bitmap
;
...
...
@@ -167,7 +172,7 @@ void Page::renderToPixmap(QPixmap **q, int x, int y, int w, int h) const
output_dev
=
new
SplashOutputDev
(
splashModeRGB8
,
4
,
gFalse
,
white
);
output_dev
->
startDoc
(
data
->
doc
->
data
->
doc
.
getXRef
());
data
->
doc
->
data
->
doc
.
displayPageSlice
(
output_dev
,
data
->
index
+
1
,
72
,
72
,
data
->
doc
->
data
->
doc
.
displayPageSlice
(
output_dev
,
data
->
index
+
1
,
xres
,
yres
,
0
,
false
,
false
,
false
,
-
1
,
-
1
,
-
1
,
-
1
);
bitmap
=
output_dev
->
getBitmap
();
color_ptr
=
bitmap
->
getDataPtr
();
...
...
@@ -223,6 +228,41 @@ QString Page::getText(const Rectangle &r) const
return
result
;
}
QValueList
<
TextBox
*>
Page
::
textList
()
const
{
TextOutputDev
*
output_dev
;
QValueList
<
TextBox
*>
output_list
;
output_dev
=
new
TextOutputDev
(
0
,
gFalse
,
gFalse
,
gFalse
);
data
->
doc
->
data
->
doc
.
displayPageSlice
(
output_dev
,
data
->
index
+
1
,
72
,
72
,
0
,
false
,
false
,
false
,
-
1
,
-
1
,
-
1
,
-
1
);
TextWordList
*
word_list
=
output_dev
->
makeWordList
();
if
(
!
word_list
)
{
delete
output_dev
;
return
output_list
;
}
for
(
int
i
=
0
;
i
<
word_list
->
getLength
();
i
++
)
{
TextWord
*
word
=
word_list
->
get
(
i
);
QString
string
=
QString
::
fromUtf8
(
word
->
getText
()
->
getCString
());
double
xMin
,
yMin
,
xMax
,
yMax
;
word
->
getBBox
(
&
xMin
,
&
yMin
,
&
xMax
,
&
yMax
);
TextBox
*
text_box
=
new
TextBox
(
string
,
Rectangle
(
xMin
,
yMin
,
xMax
,
yMax
));
output_list
.
append
(
text_box
);
}
delete
word_list
;
delete
output_dev
;
return
output_list
;
}
PageTransition
*
Page
::
getTransition
()
const
{
if
(
!
data
->
transition
)
...
...
@@ -236,4 +276,31 @@ PageTransition *Page::getTransition() const
return
data
->
transition
;
}
QSize
Page
::
pageSize
()
const
{
::
Page
*
p
=
data
->
doc
->
data
->
doc
.
getCatalog
()
->
getPage
(
data
->
index
+
1
);
return
QSize
(
(
int
)
p
->
getMediaWidth
(),
(
int
)
p
->
getMediaHeight
()
);
}
Page
::
Orientation
Page
::
orientation
()
const
{
::
Page
*
p
=
data
->
doc
->
data
->
doc
.
getCatalog
()
->
getPage
(
data
->
index
+
1
);
int
rotation
=
p
->
getRotate
();
switch
(
rotation
)
{
case
90
:
return
Page
::
Landscape
;
break
;
case
180
:
return
Page
::
UpsideDown
;
break
;
case
270
:
return
Page
::
Seascape
;
break
;
default:
return
Page
::
Portrait
;
}
}
}
qt/poppler-qt.h
View file @
e64f6341
...
...
@@ -43,6 +43,21 @@ class Rectangle
double
m_y2
;
};
class
TextBox
{
public:
TextBox
(
const
QString
&
text
,
const
Rectangle
&
bBox
)
:
m_text
(
text
),
m_bBox
(
bBox
)
{};
QString
getText
()
const
{
return
m_text
;
};
Rectangle
getBoundingBox
()
const
{
return
m_bBox
;
};
private:
QString
m_text
;
Rectangle
m_bBox
;
};
class
PageTransitionData
;
class
PageTransition
{
...
...
@@ -118,19 +133,45 @@ class Page {
friend
class
Document
;
public:
~
Page
();
void
renderToPixmap
(
QPixmap
**
q
,
int
x
,
int
y
,
int
w
,
int
h
,
double
xres
,
double
yres
)
const
;
/**
* This is a convenience function that is equivalent to
* renderToPixmap() with xres and yres set to 72.0. We keep it
* only for binary compatibility
**/
void
renderToPixmap
(
QPixmap
**
q
,
int
x
,
int
y
,
int
w
,
int
h
)
const
;
/**
* Returns the size of the page in points
**/
QSize
pageSize
()
const
;
/**
* Returns the text that is inside the Rectangle r
* If r is a null Rectangle all text of the page is given
**/
QString
getText
(
const
Rectangle
&
r
)
const
;
QValueList
<
TextBox
*>
textList
()
const
;
/**
* Returns the transition of this page
**/
PageTransition
*
getTransition
()
const
;
enum
Orientation
{
Landscape
,
Portrait
,
Seascape
,
UpsideDown
};
/**
* The orientation of the page
**/
Orientation
orientation
()
const
;
private:
Page
(
const
Document
*
doc
,
int
index
);
PageData
*
data
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment