gint height)
{
GdkPixbuf *pixbuf;
-
-#ifdef POPPLER_WITH_GDK
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- width, height);
- gdk_pixbuf_fill (pixbuf, 0xffffffff);
-
- ev_document_fc_mutex_lock ();
- poppler_page_render_to_pixbuf (poppler_page, 0, 0,
- width, height,
- rc->scale, rc->rotation, pixbuf);
- ev_document_fc_mutex_unlock ();
-#else
cairo_surface_t *surface;
ev_document_fc_mutex_lock ();
pixbuf = ev_document_misc_pixbuf_from_surface (surface);
cairo_surface_destroy (surface);
-#endif /* POPPLER_WITH_GDK */
return pixbuf;
}
{
PdfDocument *pdf_document = PDF_DOCUMENT (document);
PopplerPage *poppler_page;
+ cairo_surface_t *surface;
GdkPixbuf *pixbuf = NULL;
GdkPixbuf *border_pixbuf;
double page_width, page_height;
height = temp;
}
-#ifdef POPPLER_WITH_GDK
- pixbuf = poppler_page_get_thumbnail_pixbuf (poppler_page);
-#else
- cairo_surface_t *surface;
-
surface = poppler_page_get_thumbnail (poppler_page);
if (surface) {
pixbuf = ev_document_misc_pixbuf_from_surface (surface);
cairo_surface_destroy (surface);
}
-#endif /* POPPLER_WITH_GDK */
if (pixbuf != NULL) {
int thumb_width = (rc->rotation == 90 || rc->rotation == 270) ?
PopplerPermissions permissions;
EvPage *page;
char *metadata;
-#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
gboolean linearized;
-#endif
info = g_new0 (EvDocumentInfo, 1);
"producer", &(info->producer),
"creation-date", &(info->creation_date),
"mod-date", &(info->modified_date),
-#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
"linearized", &linearized,
-#else
- "linearized", &(info->linearized),
-#endif
"metadata", &metadata,
NULL);
info->security = g_strdup (_("No"));
}
-#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
info->linearized = linearized ? g_strdup (_("Yes")) : g_strdup (_("No"));
-#endif
return info;
}
case POPPLER_ACTION_MOVIE:
unimplemented_action = "POPPLER_ACTION_MOVIE";
break;
-#if POPPLER_CHECK_VERSION (0, 13, 2)
case POPPLER_ACTION_RENDITION:
unimplemented_action = "POPPLER_ACTION_RENDITION";
break;
}
break;
-#endif
case POPPLER_ACTION_UNKNOWN:
unimplemented_action = "POPPLER_ACTION_UNKNOWN";
}
EvSelectionStyle style,
EvRectangle *points)
{
- PopplerPage *poppler_page;
- char *retval;
-
- poppler_page = POPPLER_PAGE (page->backend_page);
-
-#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
- retval = poppler_page_get_selected_text (poppler_page,
- (PopplerSelectionStyle)style,
- (PopplerRectangle *)points);
-#else
- PopplerRectangle r;
- double height;
-
- poppler_page_get_size (poppler_page, NULL, &height);
- r.x1 = points->x1;
- r.y1 = height - points->y2;
- r.x2 = points->x2;
- r.y2 = height - points->y1;
-
- retval = poppler_page_get_text (poppler_page,
- (PopplerSelectionStyle)style,
- &r);
-#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
+ g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
- return retval;
+ return poppler_page_get_selected_text (POPPLER_PAGE (page->backend_page),
+ (PopplerSelectionStyle)style,
+ (PopplerRectangle *)points);
}
static cairo_region_t *
return retval;
}
-#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
-static gchar *
-pdf_document_text_get_text (EvDocumentText *selection,
- EvPage *page)
-{
- PopplerPage *poppler_page;
-
- g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
-
- poppler_page = POPPLER_PAGE (page->backend_page);
-
- return poppler_page_get_text (poppler_page);
-}
-#else
static gchar *
pdf_document_text_get_text (EvDocumentText *selection,
EvPage *page)
{
- PopplerPage *poppler_page;
- PopplerRectangle r;
-
g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
- poppler_page = POPPLER_PAGE (page->backend_page);
-
- r.x1 = 0;
- r.y1 = 0;
- poppler_page_get_size (poppler_page, &(r.x2), &(r.y2));
-
- return poppler_page_get_text (poppler_page,
- POPPLER_SELECTION_WORD,
- &r);
+ return poppler_page_get_text (POPPLER_PAGE (page->backend_page));
}
-#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
-#ifdef HAVE_POPPLER_PAGE_GET_TEXT_LAYOUT
static gboolean
pdf_document_text_get_text_layout (EvDocumentText *selection,
EvPage *page,
EvRectangle **areas,
guint *n_areas)
{
- PopplerPage *poppler_page;
-
g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), FALSE);
- poppler_page = POPPLER_PAGE (page->backend_page);
-
- return poppler_page_get_text_layout (poppler_page, (PopplerRectangle **)areas, n_areas);
+ return poppler_page_get_text_layout (POPPLER_PAGE (page->backend_page),
+ (PopplerRectangle **)areas, n_areas);
}
-#endif
static void
pdf_document_text_iface_init (EvDocumentTextInterface *iface)
{
iface->get_text_mapping = pdf_document_text_get_text_mapping;
iface->get_text = pdf_document_text_get_text;
-#ifdef HAVE_POPPLER_PAGE_GET_TEXT_LAYOUT
iface->get_text_layout = pdf_document_text_get_text_layout;
-#endif
}
/* Page Transitions */
static EvAnnotationTextIcon
get_annot_text_icon (PopplerAnnotText *poppler_annot)
{
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
gchar *icon = poppler_annot_text_get_icon (poppler_annot);
EvAnnotationTextIcon retval;
g_free (icon);
return retval;
-#else
- return EV_ANNOTATION_TEXT_ICON_UNKNOWN;
-#endif
}
static const gchar *
get_poppler_annot_text_icon (EvAnnotationTextIcon icon)
{
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
switch (icon) {
case EV_ANNOTATION_TEXT_ICON_NOTE:
return POPPLER_ANNOT_TEXT_ICON_NOTE;
default:
return POPPLER_ANNOT_TEXT_ICON_NOTE;
}
-#else
- return "Note";
-#endif
}
static EvAnnotation *
return PDF_DOCUMENT (document_annotations)->annots_modified;
}
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
static void
pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotations,
EvAnnotation *annot,
pdf_document->annots_modified = TRUE;
}
-#endif /* HAVE_POPPLER_PAGE_ADD_ANNOT */
static void
pdf_document_annotations_save_annotation (EvDocumentAnnotations *document_annotations,
poppler_annot_set_contents (poppler_annot,
ev_annotation_get_contents (annot));
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
if (mask & EV_ANNOTATIONS_SAVE_COLOR) {
PopplerColor color;
GdkColor ev_color;
poppler_annot_text_set_icon (text, get_poppler_annot_text_icon (icon));
}
}
-#endif /* HAVE_POPPLER_PAGE_ADD_ANNOT */
+
PDF_DOCUMENT (document_annotations)->annots_modified = TRUE;
}
{
iface->get_annotations = pdf_document_annotations_get_annotations;
iface->document_is_modified = pdf_document_annotations_document_is_modified;
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
iface->add_annotation = pdf_document_annotations_add_annotation;
-#endif
iface->save_annotation = pdf_document_annotations_save_annotation;
}