Beispiel #1
0
void write_mapping(int page_num, PopplerPage *page) {
	double w, h;
	poppler_page_get_size (page, &w, &h);

    GList *mapping = poppler_page_get_link_mapping (page);
    gint n_links = g_list_length (mapping);
    GList *l;
    
    printf("PAGE: %d\n", page_num);
    for (l = mapping; l; l = g_list_next (l)) {
    	PopplerLinkMapping *lmapping = (PopplerLinkMapping*)l->data;
	   	switch (lmapping->action->type) {
	    	case POPPLER_ACTION_URI: {
	    		PopplerActionUri *auri = (PopplerActionUri*)lmapping->action;
	    		double x1 = lmapping->area.x1 / w;
	    		double y1 = 1.0 - (lmapping->area.y1 / h);
	    		double x2 = lmapping->area.x2 / w;
	    		double y2 = 1.0 - (lmapping->area.y2 / h);
	    		printf("LINK: %f %f %f %f URI: %s\n",
	    			x1, y2, x2 - x1, y1 - y2,
					auri->uri);
	    	}
	        	break;
    	}
    }
    poppler_page_free_link_mapping (mapping);
    g_object_unref (page);
}
Beispiel #2
0
static VALUE
rg_link_mapping(VALUE self)
{
    return GLIST2ARY2F(poppler_page_get_link_mapping(SELF(self)),
                       POPPLER_TYPE_LINK_MAPPING);
}