org.jpedal.objects.raw.PageLabelObject Maven / Gradle / Ivy
/*
* ===========================================
* 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@
*
* ---------------
* PageLabelObject.java
* ---------------
*/
package org.jpedal.objects.raw;
import org.jpedal.utils.StringUtils;
/**
* @author markee
*/
public class PageLabelObject extends PdfObject {
private int St = -1; //note default is 1
String P;
byte[] rawP;
public PageLabelObject(final String key) {
super(key);
objType = PdfDictionary.PageLabels;
}
@Override
public String getTextStreamValue(final int id) {
switch (id) {
case PdfDictionary.P:
//setup first time
if (P == null && rawP != null) {
P = StringUtils.getTextString(rawP, false);
}
return P;
default:
return super.getTextStreamValue(id);
}
}
@Override
public void setTextStreamValue(final int id, final byte[] value) {
switch (id) {
case PdfDictionary.P:
rawP = value;
break;
default:
super.setTextStreamValue(id, value);
}
}
@Override
public void setIntNumber(final int id, final int value) {
switch (id) {
case PdfDictionary.St:
St = value;
break;
default:
super.setIntNumber(id, value);
}
}
@Override
public int getInt(final int id) {
switch (id) {
case PdfDictionary.St:
return St;
default:
return super.getInt(id);
}
}
}