org.jpedal.objects.PageLookup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer for NetBeans plugin
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* PageLookup.java
* ---------------
*/
package org.jpedal.objects;
import java.util.HashMap;
import java.util.Map;
/**
* allow us to lookup pages
*/
public class PageLookup {
/**
* holds pdf id (ie 4 0 R) which stores each object in reverse so we can lookup
*/
private Map pageLookup = new HashMap();
/**
* used to work out page id for the object (returns -1 if no value found)
*/
public int convertObjectToPageNumber(final String offset) {
final Integer value = pageLookup.get(offset);
if (value == null) {
return -1;
} else {
return value;
}
}
/**
* The pageLookup to set.
*/
public void put(final String key, final int value) {
pageLookup.put(key, value);
}
public void dispose() {
if (pageLookup != null) {
pageLookup.clear();
}
pageLookup = null;
}
}