Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zathura-pdf-poppler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marius
zathura-pdf-poppler
Commits
27177a20
Commit
27177a20
authored
Dec 20, 2017
by
Sebastian Ramacher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/0.2.8'
parents
ced9b3cf
806d4b8b
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
102 additions
and
91 deletions
+102
-91
attachments.c
attachments.c
+7
-6
config.mk
config.mk
+3
-3
document.c
document.c
+7
-4
forms.c
forms.c
+1
-1
image.c
image.c
+11
-8
index.c
index.c
+3
-2
links.c
links.c
+5
-4
meta.c
meta.c
+4
-4
page.c
page.c
+3
-2
plugin.c
plugin.c
+19
-23
plugin.h
plugin.h
+27
-25
render.c
render.c
+3
-2
search.c
search.c
+5
-4
select.c
select.c
+3
-2
utils.h
utils.h
+1
-1
No files found.
attachments.c
View file @
27177a20
...
...
@@ -5,15 +5,16 @@
#include "plugin.h"
girara_list_t
*
pdf_document_attachments_get
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
zathura_error_t
*
error
)
pdf_document_attachments_get
(
zathura_document_t
*
document
,
void
*
data
,
zathura_error_t
*
error
)
{
if
(
document
==
NULL
||
poppler_document
==
NULL
)
{
if
(
document
==
NULL
||
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
return
NULL
;
}
PopplerDocument
*
poppler_document
=
data
;
if
(
poppler_document_has_attachments
(
poppler_document
)
==
FALSE
)
{
girara_warning
(
"PDF file has no attachments"
);
if
(
error
!=
NULL
)
{
...
...
@@ -22,8 +23,7 @@ pdf_document_attachments_get(zathura_document_t* document, PopplerDocument* popp
return
NULL
;
}
girara_list_t
*
res
=
girara_sorted_list_new2
((
girara_compare_function_t
)
g_strcmp0
,
(
girara_free_function_t
)
g_free
);
girara_list_t
*
res
=
girara_sorted_list_new2
((
girara_compare_function_t
)
g_strcmp0
,
g_free
);
if
(
res
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_OUT_OF_MEMORY
;
...
...
@@ -42,12 +42,13 @@ pdf_document_attachments_get(zathura_document_t* document, PopplerDocument* popp
zathura_error_t
pdf_document_attachment_save
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
const
char
*
attachmentname
,
const
char
*
file
)
void
*
data
,
const
char
*
attachmentname
,
const
char
*
file
)
{
if
(
document
==
NULL
||
poppler_document
==
NULL
)
{
if
(
document
==
NULL
||
data
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
PopplerDocument
*
poppler_document
=
data
;
if
(
poppler_document_has_attachments
(
poppler_document
)
==
FALSE
)
{
girara_warning
(
"PDF file has no attachments"
);
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
...
...
config.mk
View file @
27177a20
...
...
@@ -2,7 +2,7 @@
VERSION_MAJOR
=
0
VERSION_MINOR
=
2
VERSION_REV
=
7
VERSION_REV
=
8
VERSION
=
${VERSION_MAJOR}
.
${VERSION_MINOR}
.
${VERSION_REV}
PKG_CONFIG
?=
pkg-config
...
...
@@ -12,7 +12,7 @@ PKG_CONFIG ?= pkg-config
# zathura
ZATHURA_VERSION_CHECK
?=
1
ZATHURA_MIN_VERSION
=
0.
2.0
ZATHURA_MIN_VERSION
=
0.
3.8
ZATHURA_PKG_CONFIG_NAME
=
zathura
# poppler
...
...
@@ -24,7 +24,7 @@ POPPLER_PKG_CONFIG_NAME = poppler-glib
PREFIX
?=
/usr
LIBDIR
?=
${PREFIX}
/lib
DESKTOPPREFIX
?=
${PREFIX}
/share/applications
APPDATAPREFIX
?=
${PREFIX}
/share/
appdata
APPDATAPREFIX
?=
${PREFIX}
/share/
metainfo
# libs
CAIRO_INC
?=
$(
shell
$(PKG_CONFIG)
--cflags
cairo
)
...
...
document.c
View file @
27177a20
...
...
@@ -56,12 +56,13 @@ error_free:
}
zathura_error_t
pdf_document_free
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
)
pdf_document_free
(
zathura_document_t
*
document
,
void
*
data
)
{
if
(
document
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
PopplerDocument
*
poppler_document
=
data
;
if
(
poppler_document
!=
NULL
)
{
g_object_unref
(
poppler_document
);
zathura_document_set_data
(
document
,
NULL
);
...
...
@@ -71,9 +72,9 @@ pdf_document_free(zathura_document_t* document, PopplerDocument* poppler_documen
}
zathura_error_t
pdf_document_save_as
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
const
char
*
path
)
pdf_document_save_as
(
zathura_document_t
*
document
,
void
*
data
,
const
char
*
path
)
{
if
(
document
==
NULL
||
poppler_document
==
NULL
||
path
==
NULL
)
{
if
(
document
==
NULL
||
data
==
NULL
||
path
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
...
...
@@ -83,7 +84,9 @@ pdf_document_save_as(zathura_document_t* document, PopplerDocument* poppler_docu
return
ZATHURA_ERROR_UNKNOWN
;
}
gboolean
ret
=
poppler_document_save
(
poppler_document
,
file_uri
,
NULL
);
PopplerDocument
*
poppler_document
=
data
;
const
gboolean
ret
=
poppler_document_save
(
poppler_document
,
file_uri
,
NULL
);
g_free
(
file_uri
);
return
(
ret
==
TRUE
?
ZATHURA_ERROR_OK
:
ZATHURA_ERROR_UNKNOWN
);
...
...
forms.c
View file @
27177a20
...
...
@@ -3,7 +3,7 @@
#include "plugin.h"
girara_list_t
*
pdf_page_form_fields_get
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
pdf_page_form_fields_get
(
zathura_page_t
*
page
,
void
*
poppler_page
,
zathura_error_t
*
error
)
{
if
(
error
!=
NULL
)
{
...
...
image.c
View file @
27177a20
...
...
@@ -3,12 +3,12 @@
#include "plugin.h"
#include "utils.h"
static
void
pdf_zathura_image_free
(
zathura_image_t
*
image
);
static
void
pdf_zathura_image_free
(
void
*
image
);
girara_list_t
*
pdf_page_images_get
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
zathura_error_t
*
error
)
pdf_page_images_get
(
zathura_page_t
*
page
,
void
*
data
,
zathura_error_t
*
error
)
{
if
(
page
==
NULL
||
poppler_page
==
NULL
)
{
if
(
page
==
NULL
||
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
...
...
@@ -18,6 +18,7 @@ pdf_page_images_get(zathura_page_t* page, PopplerPage* poppler_page, zathura_err
girara_list_t
*
list
=
NULL
;
GList
*
image_mapping
=
NULL
;
PopplerPage
*
poppler_page
=
data
;
image_mapping
=
poppler_page_get_image_mapping
(
poppler_page
);
if
(
image_mapping
==
NULL
||
g_list_length
(
image_mapping
)
==
0
)
{
if
(
error
!=
NULL
)
{
...
...
@@ -34,7 +35,7 @@ pdf_page_images_get(zathura_page_t* page, PopplerPage* poppler_page, zathura_err
goto
error_free
;
}
girara_list_set_free_function
(
list
,
(
girara_free_function_t
)
pdf_zathura_image_free
);
girara_list_set_free_function
(
list
,
pdf_zathura_image_free
);
for
(
GList
*
image
=
image_mapping
;
image
!=
NULL
;
image
=
g_list_next
(
image
))
{
zathura_image_t
*
zathura_image
=
g_malloc0
(
sizeof
(
zathura_image_t
));
...
...
@@ -76,10 +77,10 @@ error_ret:
}
cairo_surface_t
*
pdf_page_image_get_cairo
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
pdf_page_image_get_cairo
(
zathura_page_t
*
page
,
void
*
data
,
zathura_image_t
*
image
,
zathura_error_t
*
error
)
{
if
(
page
==
NULL
||
poppler_page
==
NULL
||
image
==
NULL
||
image
->
data
==
NULL
)
{
if
(
page
==
NULL
||
data
==
NULL
||
image
==
NULL
||
image
->
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
...
...
@@ -88,6 +89,7 @@ pdf_page_image_get_cairo(zathura_page_t* page, PopplerPage* poppler_page,
gint
*
image_id
=
(
gint
*
)
image
->
data
;
PopplerPage
*
poppler_page
=
data
;
cairo_surface_t
*
surface
=
poppler_page_get_image
(
poppler_page
,
*
image_id
);
if
(
surface
==
NULL
)
{
if
(
error
!=
NULL
)
{
...
...
@@ -104,12 +106,13 @@ error_ret:
}
static
void
pdf_zathura_image_free
(
zathura_image_t
*
image
)
pdf_zathura_image_free
(
void
*
data
)
{
if
(
image
==
NULL
)
{
if
(
data
==
NULL
)
{
return
;
}
zathura_image_t
*
image
=
data
;
if
(
image
->
data
!=
NULL
)
{
g_free
(
image
->
data
);
}
...
...
index.c
View file @
27177a20
...
...
@@ -7,15 +7,16 @@ static void build_index(PopplerDocument* poppler_document, girara_tree_node_t*
root
,
PopplerIndexIter
*
iter
);
girara_tree_node_t
*
pdf_document_index_generate
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
zathura_error_t
*
error
)
pdf_document_index_generate
(
zathura_document_t
*
document
,
void
*
data
,
zathura_error_t
*
error
)
{
if
(
document
==
NULL
||
poppler_document
==
NULL
)
{
if
(
document
==
NULL
||
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
return
NULL
;
}
PopplerDocument
*
poppler_document
=
data
;
PopplerIndexIter
*
iter
=
poppler_index_iter_new
(
poppler_document
);
if
(
iter
==
NULL
)
{
...
...
links.c
View file @
27177a20
...
...
@@ -4,17 +4,18 @@
#include "utils.h"
girara_list_t
*
pdf_page_links_get
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
zathura_error_t
*
error
)
pdf_page_links_get
(
zathura_page_t
*
page
,
void
*
data
,
zathura_error_t
*
error
)
{
if
(
page
==
NULL
||
poppler_page
==
NULL
)
{
if
(
page
==
NULL
||
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
goto
error_ret
;
}
girara_list_t
*
list
=
NULL
;
GList
*
link_mapping
=
NULL
;
girara_list_t
*
list
=
NULL
;
GList
*
link_mapping
=
NULL
;
PopplerPage
*
poppler_page
=
data
;
link_mapping
=
poppler_page_get_link_mapping
(
poppler_page
);
if
(
link_mapping
==
NULL
||
g_list_length
(
link_mapping
)
==
0
)
{
...
...
meta.c
View file @
27177a20
...
...
@@ -7,17 +7,17 @@
#define LENGTH(x) (sizeof(x)/sizeof((x)[0]))
girara_list_t
*
pdf_document_get_information
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
zathura_error_t
*
error
)
pdf_document_get_information
(
zathura_document_t
*
document
,
void
*
data
,
zathura_error_t
*
error
)
{
if
(
document
==
NULL
||
poppler_document
==
NULL
)
{
if
(
document
==
NULL
||
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
return
NULL
;
}
girara_list_t
*
list
=
zathura_document_information_entry_list_new
();
PopplerDocument
*
poppler_document
=
data
;
girara_list_t
*
list
=
zathura_document_information_entry_list_new
();
if
(
list
==
NULL
)
{
return
NULL
;
}
...
...
page.c
View file @
27177a20
...
...
@@ -9,7 +9,7 @@ pdf_page_init(zathura_page_t* page)
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
zathura_document_t
*
document
=
zathura_page_get_document
(
page
);
zathura_document_t
*
document
=
zathura_page_get_document
(
page
);
PopplerDocument
*
poppler_document
=
zathura_document_get_data
(
document
);
if
(
poppler_document
==
NULL
)
{
...
...
@@ -37,12 +37,13 @@ pdf_page_init(zathura_page_t* page)
}
zathura_error_t
pdf_page_clear
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
)
pdf_page_clear
(
zathura_page_t
*
page
,
void
*
data
)
{
if
(
page
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
PopplerPage
*
poppler_page
=
data
;
if
(
poppler_page
!=
NULL
)
{
g_object_unref
(
poppler_page
);
}
...
...
plugin.c
View file @
27177a20
...
...
@@ -2,31 +2,27 @@
#include "plugin.h"
void
register_functions
(
zathura_plugin_functions_t
*
functions
)
{
functions
->
document_open
=
(
zathura_plugin_document_open_t
)
pdf_document_open
;
functions
->
document_free
=
(
zathura_plugin_document_free_t
)
pdf_document_free
;
functions
->
document_index_generate
=
(
zathura_plugin_document_index_generate_t
)
pdf_document_index_generate
;
functions
->
document_save_as
=
(
zathura_plugin_document_save_as_t
)
pdf_document_save_as
;
functions
->
document_attachments_get
=
(
zathura_plugin_document_attachments_get_t
)
pdf_document_attachments_get
;
functions
->
document_attachment_save
=
(
zathura_plugin_document_attachment_save_t
)
pdf_document_attachment_save
;
functions
->
document_get_information
=
(
zathura_plugin_document_get_information_t
)
pdf_document_get_information
;
functions
->
page_init
=
(
zathura_plugin_page_init_t
)
pdf_page_init
;
functions
->
page_clear
=
(
zathura_plugin_page_clear_t
)
pdf_page_clear
;
functions
->
page_search_text
=
(
zathura_plugin_page_search_text_t
)
pdf_page_search_text
;
functions
->
page_links_get
=
(
zathura_plugin_page_links_get_t
)
pdf_page_links_get
;
functions
->
page_form_fields_get
=
(
zathura_plugin_page_form_fields_get_t
)
pdf_page_form_fields_get
;
functions
->
page_images_get
=
(
zathura_plugin_page_images_get_t
)
pdf_page_images_get
;
functions
->
page_get_text
=
(
zathura_plugin_page_get_text_t
)
pdf_page_get_text
;
functions
->
page_render_cairo
=
(
zathura_plugin_page_render_cairo_t
)
pdf_page_render_cairo
;
functions
->
page_image_get_cairo
=
(
zathura_plugin_page_image_get_cairo_t
)
pdf_page_image_get_cairo
;
}
ZATHURA_PLUGIN_REGISTER
(
ZATHURA_PLUGIN_REGISTER_WITH_FUNCTIONS
(
"pdf-poppler"
,
VERSION_MAJOR
,
VERSION_MINOR
,
VERSION_REV
,
register_functions
,
ZATHURA_PLUGIN_FUNCTIONS
({
.
document_open
=
pdf_document_open
,
.
document_free
=
pdf_document_free
,
.
document_index_generate
=
pdf_document_index_generate
,
.
document_save_as
=
pdf_document_save_as
,
.
document_attachments_get
=
pdf_document_attachments_get
,
.
document_attachment_save
=
pdf_document_attachment_save
,
.
document_get_information
=
pdf_document_get_information
,
.
page_init
=
pdf_page_init
,
.
page_clear
=
pdf_page_clear
,
.
page_search_text
=
pdf_page_search_text
,
.
page_links_get
=
pdf_page_links_get
,
.
page_form_fields_get
=
pdf_page_form_fields_get
,
.
page_images_get
=
pdf_page_images_get
,
.
page_get_text
=
pdf_page_get_text
,
.
page_render_cairo
=
pdf_page_render_cairo
,
.
page_image_get_cairo
=
pdf_page_image_get_cairo
}),
ZATHURA_PLUGIN_MIMETYPES
({
"application/pdf"
})
...
...
plugin.h
View file @
27177a20
...
...
@@ -8,6 +8,8 @@
#include <cairo.h>
#include <girara/macros.h>
#include <zathura/page.h>
#include <zathura/document.h>
#include <zathura/plugin-api.h>
...
...
@@ -19,7 +21,7 @@
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_document_open
(
zathura_document_t
*
document
);
GIRARA_HIDDEN
zathura_error_t
pdf_document_open
(
zathura_document_t
*
document
);
/**
* Closes and frees the internal document structure
...
...
@@ -28,7 +30,7 @@ zathura_error_t pdf_document_open(zathura_document_t* document);
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_document_free
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
);
GIRARA_HIDDEN
zathura_error_t
pdf_document_free
(
zathura_document_t
*
document
,
void
*
poppler_document
);
/**
* Initializes the page with the needed values
...
...
@@ -37,7 +39,7 @@ zathura_error_t pdf_document_free(zathura_document_t* document, PopplerDocument*
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_page_init
(
zathura_page_t
*
page
);
GIRARA_HIDDEN
zathura_error_t
pdf_page_init
(
zathura_page_t
*
page
);
/**
* Frees the data that is used by the plugin in the page
...
...
@@ -46,7 +48,7 @@ zathura_error_t pdf_page_init(zathura_page_t* page);
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_page_clear
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
);
GIRARA_HIDDEN
zathura_error_t
pdf_page_clear
(
zathura_page_t
*
page
,
void
*
poppler_page
);
/**
* Saves the document to the given path
...
...
@@ -56,8 +58,8 @@ zathura_error_t pdf_page_clear(zathura_page_t* page, PopplerPage* poppler_page);
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_document_save_as
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
const
char
*
path
);
GIRARA_HIDDEN
zathura_error_t
pdf_document_save_as
(
zathura_document_t
*
document
,
void
*
poppler_document
,
const
char
*
path
);
/**
* Generates the index of the document
...
...
@@ -68,8 +70,8 @@ zathura_error_t pdf_document_save_as(zathura_document_t* document,
* @return Tree node object or NULL if an error occurred (e.g.: the document has
* no index)
*/
girara_tree_node_t
*
pdf_document_index_generate
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
girara_tree_node_t
*
pdf_document_index_generate
(
zathura_document_t
*
document
,
void
*
poppler_document
,
zathura_error_t
*
error
);
/**
* Returns a list of attachments included in the zathura document
...
...
@@ -79,8 +81,8 @@ girara_tree_node_t* pdf_document_index_generate(zathura_document_t* document,
* error occurred
* @return List of attachments or NULL if an error occurred
*/
girara_list_t
*
pdf_document_attachments_get
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
girara_list_t
*
pdf_document_attachments_get
(
zathura_document_t
*
document
,
void
*
poppler_document
,
zathura_error_t
*
error
);
/**
* Saves an attachment to a file
...
...
@@ -91,8 +93,8 @@ girara_list_t* pdf_document_attachments_get(zathura_document_t* document,
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_document_attachment_save
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
const
char
*
attachment
,
const
char
*
filename
);
GIRARA_HIDDEN
zathura_error_t
pdf_document_attachment_save
(
zathura_document_t
*
document
,
void
*
poppler_document
,
const
char
*
attachment
,
const
char
*
filename
);
/**
* Returns a list of images included on the zathura page
...
...
@@ -102,8 +104,8 @@ zathura_error_t pdf_document_attachment_save(zathura_document_t*
* error occurred
* @return List of images
*/
girara_list_t
*
pdf_page_images_get
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
girara_list_t
*
pdf_page_images_get
(
zathura_page_t
*
page
,
void
*
poppler_page
,
zathura_error_t
*
error
);
/**
* Gets the content of the image in a cairo surface
...
...
@@ -114,8 +116,8 @@ girara_list_t* pdf_page_images_get(zathura_page_t* page,
* error occurred
* @return The cairo image surface or NULL if an error occurred
*/
cairo_surface_t
*
pdf_page_image_get_cairo
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
zathura_image_t
*
image
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
cairo_surface_t
*
pdf_page_image_get_cairo
(
zathura_page_t
*
page
,
void
*
poppler_page
,
zathura_image_t
*
image
,
zathura_error_t
*
error
);
/**
* Returns a list of document information entries of the document
...
...
@@ -125,8 +127,8 @@ cairo_surface_t* pdf_page_image_get_cairo(zathura_page_t* page,
* error occurred
* @return List of information entries or NULL if an error occurred
*/
girara_list_t
*
pdf_document_get_information
(
zathura_document_t
*
document
,
PopplerDocument
*
poppler_document
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
girara_list_t
*
pdf_document_get_information
(
zathura_document_t
*
document
,
void
*
poppler_document
,
zathura_error_t
*
error
);
/**
* Searches for a specific text on a page and returns a list of results
...
...
@@ -137,7 +139,7 @@ girara_list_t* pdf_document_get_information(zathura_document_t* document,
* error occurred
* @return List of search results or NULL if an error occurred
*/
girara_list_t
*
pdf_page_search_text
(
zathura_page_t
*
page
,
PopplerPage
*
GIRARA_HIDDEN
girara_list_t
*
pdf_page_search_text
(
zathura_page_t
*
page
,
void
*
data
,
const
char
*
text
,
zathura_error_t
*
error
);
/**
...
...
@@ -148,8 +150,8 @@ girara_list_t* pdf_page_search_text(zathura_page_t* page, PopplerPage*
* error occurred
* @return List of links or NULL if an error occurred
*/
girara_list_t
*
pdf_page_links_get
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
girara_list_t
*
pdf_page_links_get
(
zathura_page_t
*
page
,
void
*
poppler_page
,
zathura_error_t
*
error
);
/**
* Returns a list of form fields available on the given page
...
...
@@ -159,8 +161,8 @@ girara_list_t* pdf_page_links_get(zathura_page_t* page,
* error occurred
* @return List of form fields or NULL if an error occurred
*/
girara_list_t
*
pdf_page_form_fields_get
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
zathura_error_t
*
error
);
GIRARA_HIDDEN
girara_list_t
*
pdf_page_form_fields_get
(
zathura_page_t
*
page
,
void
*
poppler_page
,
zathura_error_t
*
error
);
/**
* Get text for selection
...
...
@@ -170,7 +172,7 @@ girara_list_t* pdf_page_form_fields_get(zathura_page_t* page,
* occurred
* @return The selected text (needs to be deallocated with g_free)
*/
char
*
pdf_page_get_text
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
GIRARA_HIDDEN
char
*
pdf_page_get_text
(
zathura_page_t
*
page
,
void
*
poppler_page
,
zathura_rectangle_t
rectangle
,
zathura_error_t
*
error
);
/**
...
...
@@ -182,7 +184,7 @@ char* pdf_page_get_text(zathura_page_t* page, PopplerPage* poppler_page,
* @return ZATHURA_ERROR_OK when no error occurred, otherwise see
* zathura_error_t
*/
zathura_error_t
pdf_page_render_cairo
(
zathura_page_t
*
page
,
PopplerPage
*
GIRARA_HIDDEN
zathura_error_t
pdf_page_render_cairo
(
zathura_page_t
*
page
,
void
*
poppler_page
,
cairo_t
*
cairo
,
bool
printing
);
#endif // PDF_H
render.c
View file @
27177a20
...
...
@@ -3,13 +3,14 @@
#include "plugin.h"
zathura_error_t
pdf_page_render_cairo
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
cairo_t
*
pdf_page_render_cairo
(
zathura_page_t
*
page
,
void
*
data
,
cairo_t
*
cairo
,
bool
printing
)
{
if
(
page
==
NULL
||
poppler_page
==
NULL
||
cairo
==
NULL
)
{
if
(
page
==
NULL
||
data
==
NULL
||
cairo
==
NULL
)
{
return
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
PopplerPage
*
poppler_page
=
data
;
if
(
printing
==
false
)
{
poppler_page_render
(
poppler_page
,
cairo
);
}
else
{
...
...
search.c
View file @
27177a20
...
...
@@ -5,18 +5,19 @@
#include "plugin.h"
girara_list_t
*
pdf_page_search_text
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
const
pdf_page_search_text
(
zathura_page_t
*
page
,
void
*
data
,
const
char
*
text
,
zathura_error_t
*
error
)
{
if
(
page
==
NULL
||
poppler_page
==
NULL
||
text
==
NULL
||
strlen
(
text
)
==
0
)
{
if
(
page
==
NULL
||
data
==
NULL
||
text
==
NULL
||
strlen
(
text
)
==
0
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
goto
error_ret
;
}
GList
*
results
=
NULL
;
girara_list_t
*
list
=
NULL
;
PopplerPage
*
poppler_page
=
data
;
GList
*
results
=
NULL
;
girara_list_t
*
list
=
NULL
;
/* search text */
results
=
poppler_page_find_text
(
poppler_page
,
text
);
...
...
select.c
View file @
27177a20
...
...
@@ -3,10 +3,10 @@
#include "plugin.h"
char
*
pdf_page_get_text
(
zathura_page_t
*
page
,
PopplerPage
*
poppler_page
,
pdf_page_get_text
(
zathura_page_t
*
page
,
void
*
data
,
zathura_rectangle_t
rectangle
,
zathura_error_t
*
error
)
{
if
(
page
==
NULL
||
poppler_page
==
NULL
)
{
if
(
page
==
NULL
||
data
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_ERROR_INVALID_ARGUMENTS
;
}
...
...
@@ -19,6 +19,7 @@ pdf_page_get_text(zathura_page_t* page, PopplerPage* poppler_page,
.
y1
=
rectangle
.
y1
,
.
y2
=
rectangle
.
y2
};
PopplerPage
*
poppler_page
=
data
;
/* get selected text */
return
poppler_page_get_selected_text
(
poppler_page
,
POPPLER_SELECTION_GLYPH
,
&
rect
);
...
...
utils.h
View file @
27177a20
...
...
@@ -14,7 +14,7 @@
*
* @return Zathura link object
*/
zathura_link_t
*
poppler_link_to_zathura_link
(
PopplerDocument
*
poppler_document
,
GIRARA_HIDDEN
zathura_link_t
*
poppler_link_to_zathura_link
(
PopplerDocument
*
poppler_document
,
PopplerAction
*
poppler_action
,
zathura_rectangle_t
position
);
#endif // UTILS_H
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