public abstract class PDFAction extends PDFObject {
- /**
- * create an Action object.
- * this constructor is used for passing on the object number to the PDFObject
- *
- * @param number the object's number
- */
- public PDFAction(int number) {
-
- /* generic creation of object */
- super(number);
- }
-
- /**
- * empty constructor for PDFAction.
- * this constructor is used when there is no additional object being created
- *
- */
- public PDFAction() { }
-
/**
* represent the action to call
* this method should be implemented to return the action which gets
public abstract String getAction();
- /**
- * represent the object in PDF
- * this method should be implemented to return the PDF which is to be
- * generated by the Action object
- *
- * @return the PDF string
- */
- public abstract byte[] toPDF();
-
}
package org.apache.fop.pdf;
// Java
-import java.util.Vector;
+import java.util.List;
/**
* class representing an object which is a list of annotations.
/**
* the /Annot objects
*/
- protected Vector links = new Vector();
-
- /**
- * the number of /Annot objects
- */
- protected int count = 0;
-
- /**
- * create a /Annots object.
- *
- * @param number the object's number
- */
- public PDFAnnotList(int number) {
-
- /* generic creation of object */
- super(number);
- }
+ private List links = new java.util.Vector();
/**
* add an /Annot object of /Subtype /Link.
* @param link the PDFLink to add.
*/
public void addAnnot(PDFObject link) {
- this.links.addElement(link);
- this.count++;
+ this.links.add(link);
}
/**
* @return the number of links
*/
public int getCount() {
- return this.count;
+ return this.links.size();
}
/**
- * represent the object in PDF
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer(this.number + " " + this.generation
- + " obj\n[\n");
- for (int i = 0; i < this.count; i++) {
- p = p.append(((PDFObject)links.elementAt(i)).referencePDF()
- + "\n");
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID());
+ p.append("[\n");
+ for (int i = 0; i < getCount(); i++) {
+ p.append(((PDFObject)links.get(i)).referencePDF());
+ p.append("\n");
}
- p = p.append("]\nendobj\n");
- return p.toString().getBytes();
+ p.append("]\nendobj\n");
+ return p.toString();
}
/*
/**
* create the array object
*
- * @param number the object's number
* @param values the actual array wrapped by this object
*/
- public PDFArray(int number, int[] values) {
+ public PDFArray(int[] values) {
/* generic creation of PDF object */
- super(number);
+ super();
/* set fields using paramaters */
this.values = values;
}
/**
- * produce the PDF representation for the object
- *
- * @return the PDF
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer();
- p.append(this.number + " " + this.generation + " obj\n[");
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(64);
+ p.append(getObjectID() + "[");
for (int i = 0; i < values.length; i++) {
p.append(" ");
p.append(values[i]);
}
p.append("]\nendobj\n");
- return p.toString().getBytes();
+ return p.toString();
}
}
/**
* Create the /Font object
- * @param number PDF object number
* @param basefont Name of the basefont
* @param cidtype CID type
* @param dw default width
* @param supplement Supplement number
* @param descriptor CID font descriptor
*/
- public PDFCIDFont(int number, String basefont, CIDFontType cidtype, int dw,
+ public PDFCIDFont(String basefont, CIDFontType cidtype, int dw,
int[] w, String registry, String ordering,
int supplement, PDFCIDFontDescriptor descriptor) {
- this(number, basefont, cidtype, dw,
+ this(basefont, cidtype, dw,
new PDFWArray(w),
new PDFCIDSystemInfo(registry, ordering, supplement),
descriptor);
/**
* Create the /Font object
- * @param number PDF object number
* @param basefont Name of the basefont
* @param cidtype CID type
* @param dw default width
* @param systemInfo CID system info
* @param descriptor CID font descriptor
*/
- public PDFCIDFont(int number, String basefont, CIDFontType cidtype, int dw,
+ public PDFCIDFont(String basefont, CIDFontType cidtype, int dw,
int[] w, PDFCIDSystemInfo systemInfo,
PDFCIDFontDescriptor descriptor) {
- this(number, basefont, cidtype, dw,
+ this(basefont, cidtype, dw,
new PDFWArray(w),
systemInfo,
descriptor);
/**
* Create the /Font object
- * @param number PDF object number
* @param basefont Name of the basefont
* @param cidtype CID type
* @param dw default width
* @param systemInfo CID system info
* @param descriptor CID font descriptor
*/
- public PDFCIDFont(int number, String basefont, CIDFontType cidtype, int dw,
+ public PDFCIDFont(String basefont, CIDFontType cidtype, int dw,
PDFWArray w, PDFCIDSystemInfo systemInfo,
PDFCIDFontDescriptor descriptor) {
- super(number);
+ super();
this.basefont = basefont;
this.cidtype = cidtype;
}
/**
- * Produce the PDF representation for the object
- *
- * @return the PDF
- */
- public byte[] toPDF() {
- return toPDFString().getBytes();
- }
-
- /**
- * Produce the PDF representation for the object
- * @return the generated code
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
public String toPDFString() {
- StringBuffer p = new StringBuffer();
- p.append(this.number);
- p.append(" ");
- p.append(this.generation);
- p.append(" obj\n<< /Type /Font");
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID());
+ p.append("<< /Type /Font");
p.append("\n/BaseFont /");
p.append(this.basefont);
if (cidMap != null) {
/**
* create the /FontDescriptor object
*
- * @param number the object's number
* @param basefont the base font name
* @param fontBBox the bounding box for the described font
* @param flags various characteristics of the font
* @param italicAngle the angle of the vertical dominant strokes
* @param lang the language
*/
- public PDFCIDFontDescriptor(int number, String basefont, int[] fontBBox,
+ public PDFCIDFontDescriptor(String basefont, int[] fontBBox,
int capHeight, int flags, int italicAngle,
int stemV, String lang) {
- super(number, basefont, fontBBox[3], fontBBox[1], capHeight, flags,
+ super(basefont, fontBBox[3], fontBBox[1], capHeight, flags,
new PDFRectangle(fontBBox), italicAngle, stemV);
this.lang = lang;
this.supplement = supplement;
}
- /**
- * produce the PDF representation for the object.
- *
- * unlike the other objects, the CIDSystemInfo is written directly inside
- * the referencing object
- *
- * @return the PDF
- */
- public byte[] toPDF() {
- return toPDFString().getBytes();
- }
-
/**
* Create a string for the CIDSystemInfo dictionary.
* The entries are placed as an inline dictionary.
* @return the string for the CIDSystemInfo entry with the inline dictionary
*/
public String toPDFString() {
- StringBuffer p = new StringBuffer();
+ StringBuffer p = new StringBuffer(64);
p.setLength(0);
p.append("/CIDSystemInfo << /Registry (");
p.append(registry);
- p.append(")/Ordering (");
+ p.append(") /Ordering (");
p.append(ordering);
- p.append(")/Supplement ");
+ p.append(") /Supplement ");
p.append(supplement);
p.append(" >>");
return p.toString();
/**
* create the /CMap object
*
- * @param number the pdf object number
* @param name one the registered names (see Table 7.20 on p 215)
* @param sysInfo the attributes of the character collection of the CIDFont
*/
- public PDFCMap(int number, String name, PDFCIDSystemInfo sysInfo) {
- super(number);
+ public PDFCMap(String name, PDFCIDSystemInfo sysInfo) {
+ super();
this.name = name;
this.sysInfo = sysInfo;
this.base = null;
import java.util.List;
import java.util.Map;
import java.util.Iterator;
-import java.util.HashMap;
/**
* class representing an /Encoding object.
/**
* create the /Encoding object
*
- * @param number the object's number
* @param basename the name of the character encoding schema
*/
- public PDFEncoding(int number, String basename) {
+ public PDFEncoding(String basename) {
/* generic creation of PDF object */
- super(number);
+ super();
/* set fields using paramaters */
this.basename = basename;
- this.differences = new HashMap();
+ this.differences = new java.util.HashMap();
}
/**
}
/**
- * produce the PDF representation for the object
- *
- * @return the PDF
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer();
- p.append(this.number + " " + this.generation
- + " obj\n<< /Type /Encoding");
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID()
+ + "<< /Type /Encoding");
if ((basename != null) && (!basename.equals(""))) {
p.append("\n/BaseEncoding /" + this.basename);
}
p.append(" ]");
}
p.append(" >>\nendobj\n");
- return p.toString().getBytes();
+ return p.toString();
}
/*
/**
* create a /FileSpec object.
*
- * @param number the object's number
* @param filename the filename represented by this object
*/
- public PDFFileSpec(int number, String filename) {
+ public PDFFileSpec(String filename) {
/* generic creation of object */
- super(number);
+ super();
this.filename = filename;
}
/**
- * represent the object in PDF
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- String p = new String(this.number + " " + this.generation
- + " obj\n<<\n/Type /FileSpec\n" + "/F ("
- + this.filename + ")\n" + ">>\nendobj\n");
- return p.getBytes();
+ public String toPDFString() {
+ return getObjectID()
+ + "<<\n/Type /FileSpec\n"
+ + "/F (" + this.filename + ")\n"
+ + ">>\nendobj\n";
}
/*
/**
* create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param subtype the font's subtype
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
*/
- public PDFFont(int number, String fontname, FontType subtype,
+ public PDFFont(String fontname, FontType subtype,
String basefont,
Object encoding /* , PDFToUnicode mapping */) {
/* generic creation of PDF object */
- super(number);
+ super();
/* set fields using paramaters */
this.fontname = fontname;
/**
* factory method with the basic parameters
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param subtype the font's subtype
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
* @return the generated PDFFont object
*/
- public static PDFFont createFont(int number, String fontname,
+ public static PDFFont createFont(String fontname,
FontType subtype, String basefont,
Object encoding) {
if (subtype == FontType.TYPE0) {
- return new PDFFontType0(number, fontname, basefont,
+ return new PDFFontType0(fontname, basefont,
encoding);
} else if ((subtype == FontType.TYPE1)
|| (subtype == FontType.MMTYPE1)) {
- return new PDFFontType1(number, fontname, basefont,
+ return new PDFFontType1(fontname, basefont,
encoding);
} else if (subtype == FontType.TYPE3) {
//return new PDFFontType3(number, fontname, basefont, encoding);
return null; //NYI
} else if (subtype == FontType.TRUETYPE) {
- return new PDFFontTrueType(number, fontname, basefont,
+ return new PDFFontTrueType(fontname, basefont,
encoding);
} else {
return null; // should not happend
* factory method with the extended parameters
* for Type1, MMType1 and TrueType
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param subtype the font's subtype
* @param basefont the base font name
* @param descriptor the descriptor for other font's metrics
* @return the generated PDFFont object
*/
- public static PDFFont createFont(int number, String fontname,
+ public static PDFFont createFont(String fontname,
FontType subtype, String basefont,
Object encoding, int firstChar,
int lastChar, PDFArray widths,
PDFFontNonBase14 font;
if (subtype == FontType.TYPE0) {
- font = new PDFFontType0(number, fontname, basefont,
+ font = new PDFFontType0(fontname, basefont,
encoding);
font.setDescriptor(descriptor);
return font;
} else if ((subtype == FontType.TYPE1)
|| (subtype == FontType.MMTYPE1)) {
- font = new PDFFontType1(number, fontname, basefont,
+ font = new PDFFontType1(fontname, basefont,
encoding);
font.setWidthMetrics(firstChar, lastChar, widths);
font.setDescriptor(descriptor);
} else if (subtype == FontType.TYPE3) {
return null; //NYI, should not happend
} else if (subtype == FontType.TRUETYPE) {
- font = new PDFFontTrueType(number, fontname, basefont,
+ font = new PDFFontTrueType(fontname, basefont,
encoding);
font.setWidthMetrics(firstChar, lastChar, widths);
font.setDescriptor(descriptor);
}
/**
- * Produce the PDF representation for the object
- *
- * @return the PDF
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer();
- p.append(this.number + " " + this.generation
- + " obj\n<< /Type /Font\n/Subtype /"
- + getPDFNameForFontType(this.subtype) + "\n/Name /" + this.fontname
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID());
+ p.append("<< /Type /Font\n/Subtype /"
+ + getPDFNameForFontType(this.subtype)
+ + "\n/Name /" + this.fontname
+ "\n/BaseFont /" + this.basefont);
if (encoding != null) {
p.append("\n/Encoding ");
}
fillInPDF(p);
p.append(" >>\nendobj\n");
- return p.toString().getBytes();
+ return p.toString();
}
/**
/**
* Create the /FontDescriptor object
*
- * @param number the object's number
* @param ascent the maximum height above the baseline
* @param descent the maximum depth below the baseline
* @param capHeight height of the capital letters
* @param italicAngle the angle of the vertical dominant strokes
* @param stemV the width of the dominant vertical stems of glyphs
*/
- public PDFFontDescriptor(int number, String basefont, int ascent,
+ public PDFFontDescriptor(String basefont, int ascent,
int descent, int capHeight, int flags,
PDFRectangle fontBBox, int italicAngle,
int stemV) {
/* generic creation of PDF object */
- super(number);
+ super();
/* set fields using paramaters */
this.basefont = basefont;
// public void setCharSet(){}//for subset fonts
/**
- * Produce the PDF representation for the object
- *
- * @return the PDF
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer(this.number + " " + this.generation
- + " obj\n<< /Type /FontDescriptor"
- + "\n/FontName /" + this.basefont);
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID()
+ + "<< /Type /FontDescriptor"
+ + "\n/FontName /" + this.basefont);
p.append("\n/FontBBox ");
p.append(fontBBox.toPDFString());
// charSet for subset fonts // not yet implemented
// CID optional field
fillInPDF(p);
- p.append("\n >>\nendobj\n");
- return p.toString().getBytes();
+ p.append(" >>\nendobj\n");
+ return p.toString();
}
/**
/**
* Create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param subtype the font's subtype
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
*/
- public PDFFontNonBase14(int number, String fontname, FontType subtype,
+ public PDFFontNonBase14(String fontname, FontType subtype,
String basefont,
Object encoding) {
/* generic creation of PDF object */
- super(number, fontname, subtype, basefont, encoding);
+ super(fontname, subtype, basefont, encoding);
this.descriptor = null;
}
/**
* create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
*/
- public PDFFontTrueType(int number, String fontname,
+ public PDFFontTrueType(String fontname,
String basefont,
Object encoding) {
/* generic creation of PDF object */
- super(number, fontname, FontType.TRUETYPE, basefont, encoding /* , mapping */);
+ super(fontname, FontType.TRUETYPE, basefont, encoding /* , mapping */);
}
}
/**
* Create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
*/
- public PDFFontType0(int number, String fontname,
+ public PDFFontType0(String fontname,
String basefont,
Object encoding) {
/* generic creation of PDF object */
- super(number, fontname, FontType.TYPE0, basefont, encoding /* , mapping */);
+ super(fontname, FontType.TYPE0, basefont, encoding /* , mapping */);
/* set fields using paramaters */
this.descendantFonts = null;
/**
* Create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
* @param descendantFonts the CIDFont upon which this font is based
*/
- public PDFFontType0(int number, String fontname,
+ public PDFFontType0(String fontname,
String basefont,
Object encoding,
PDFCIDFont descendantFonts) {
/* generic creation of PDF object */
- super(number, fontname, FontType.TYPE0, basefont, encoding /* , mapping */);
+ super(fontname, FontType.TYPE0, basefont, encoding /* , mapping */);
/* set fields using paramaters */
this.descendantFonts = descendantFonts;
/**
* Create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
*/
- public PDFFontType1(int number, String fontname,
+ public PDFFontType1(String fontname,
String basefont,
Object encoding) {
/* generic creation of PDF object */
- super(number, fontname, FontType.TYPE1, basefont, encoding);
+ super(fontname, FontType.TYPE1, basefont, encoding);
}
}
/**
* Create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
*/
- public PDFFontType3(int number, String fontname,
+ public PDFFontType3(String fontname,
String basefont,
Object encoding) {
/* generic creation of PDF object */
- super(number, fontname, FontType.TYPE3, basefont, encoding /* , mapping */);
+ super(fontname, FontType.TYPE3, basefont, encoding /* , mapping */);
this.fontBBox = null;
this.fontMatrix = null;
/**
* Create the /Font object
*
- * @param number the object's number
* @param fontname the internal name for the font
* @param basefont the base font name
* @param encoding the character encoding schema used by the font
* @param fontMatrix the font's transformation matrix
* @param charProcs the glyphs' definitions
*/
- public PDFFontType3(int number, String fontname,
+ public PDFFontType3(String fontname,
String basefont,
Object encoding,
PDFRectangle fontBBox, PDFArray fontMatrix,
PDFCharProcs charProcs) {
/* generic creation of PDF object */
- super(number, fontname, FontType.TYPE3, basefont, encoding /* , mapping */);
+ super(fontname, FontType.TYPE3, basefont, encoding /* , mapping */);
this.fontBBox = fontBBox;
this.fontMatrix = fontMatrix;
* This is not documented in the Function section of the PDF 1.3 spec,
* it was deduced from samples that this is sometimes used, even if we may never
* use it in FOP. It is added for completeness sake.
- * @param theNumber The object number of this PDF object.
* @param theFunctionType This is the type of function (0,2,3, or 4).
* It should be 0 as this is the constructor for sampled functions.
*/
- public PDFFunction(int theNumber, int theFunctionType, List theDomain,
+ public PDFFunction(int theFunctionType, List theDomain,
List theRange, List theSize, int theBitsPerSample,
int theOrder, List theEncode, List theDecode,
StringBuffer theFunctionDataStream, List theFilter) {
- super(theNumber);
+ super();
this.functionType = 0; // dang well better be 0;
this.size = theSize;
* Use null for an optional object parameter if you choose not to use it.
* For optional int parameters, pass the default.
*
- * @param theNumber the object's number
* @param theDomain List objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
* PDF Spec page 268
* @param theFunctionType The type of the function, which should be 2.
*/
- public PDFFunction(int theNumber, int theFunctionType, List theDomain,
+ public PDFFunction(int theFunctionType, List theDomain,
List theRange, List theCZero, List theCOne,
double theInterpolationExponentN) {
- super(theNumber);
+ super();
this.functionType = 2; // dang well better be 2;
* Use null for an optional object parameter if you choose not to use it.
* For optional int parameters, pass the default.
*
- * @param theNumber the object's number
* @param theDomain List objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
* @param theFunctionType This is the function type. It should be 3,
* for a stitching function.
*/
- public PDFFunction(int theNumber, int theFunctionType, List theDomain,
+ public PDFFunction(int theFunctionType, List theDomain,
List theRange, List theFunctions,
List theBounds, List theEncode) {
- super(theNumber);
+ super();
this.functionType = 3; // dang well better be 3;
*
* This attribute is required.
* It's described on page 269 of the PDF 1.3 spec.
- * @param theNumber The object number of this PDF object.
* @param theFunctionType The type of function which should be 4, as this is
* a Postscript calculator function
*/
- public PDFFunction(int theNumber, int theFunctionType, List theDomain,
+ public PDFFunction(int theFunctionType, List theDomain,
List theRange, StringBuffer theFunctionDataStream) {
- super(theNumber);
+ super();
this.functionType = 4; // dang well better be 4;
this.functionDataStream = theFunctionDataStream;
int vectorSize = 0;
int numberOfFunctions = 0;
int tempInt = 0;
- StringBuffer p = new StringBuffer();
- p.append(this.number + " " + this.generation
- + " obj\n<< \n/FunctionType " + this.functionType + " \n");
+ StringBuffer p = new StringBuffer(256);
+ p.append(getObjectID()
+ + "<< \n/FunctionType " + this.functionType + " \n");
// FunctionType 0
if (this.functionType == 0) {
}
- return (p.toString().getBytes());
+ return encode(p.toString());
}
public static final PDFGState DEFAULT;
static {
- DEFAULT = new PDFGState(0);
+ DEFAULT = new PDFGState();
Map vals = DEFAULT.values;
/*vals.put(LW, new Float(1.0));
vals.put(LC, new Integer(0));
private Map values = new java.util.HashMap();
- /**
- * Create a /ExtGState object.
- *
- * @param number the object's number
- */
- public PDFGState(int number) {
- /* generic creation of object */
- super(number);
- }
-
/**
* Returns the name of this object
* @return the name
*/
public String getName() {
- return "GS" + this.number;
+ return "GS" + getObjectNumber();
}
/**
}
/**
- * Represent the object in PDF.
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer sb = new StringBuffer(this.number + " " + this.generation
- + " obj\n<<\n/Type /ExtGState\n");
+ public String toPDFString() {
+ StringBuffer sb = new StringBuffer(64);
+ sb.append(getObjectID());
+ sb.append("<<\n/Type /ExtGState\n");
appendVal(sb, GSTATE_ALPHA_NONSTROKE);
appendVal(sb, GSTATE_ALPHA_STROKE);
sb.append(">>\nendobj\n");
- return sb.toString().getBytes();
+ return sb.toString();
}
private void appendVal(StringBuffer sb, String name) {
/**
* create a /GoTo object.
*
- * @param number the object's number
* @param pageReference the pageReference represented by this object
*/
- public PDFGoTo(int number, String pageReference) {
+ public PDFGoTo(String pageReference) {
/* generic creation of object */
- super(number);
+ super();
this.pageReference = pageReference;
}
}
/**
- * represent the object in PDF
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
+ public String toPDFString() {
String dest;
if (destination == null) {
dest = "/D [" + this.pageReference + " /XYZ " + xPosition
} else {
dest = "/D [" + this.pageReference + " " + destination + "]\n";
}
- String p = new String(this.number + " " + this.generation
- + " obj\n<<\n/S /GoTo\n" + dest
- + ">>\nendobj\n");
- return p.getBytes();
+ return getObjectID()
+ + "<< /Type /Action\n/S /GoTo\n" + dest
+ + ">>\nendobj\n";
}
/*
/**
* create an GoToR object.
*
- * @param number the object's number
* @param pdfFileSpec the fileSpec associated with the action
*/
- public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec) {
+ public PDFGoToRemote(PDFFileSpec pdfFileSpec) {
/* generic creation of object */
- super(number);
+ super();
this.pdfFileSpec = pdfFileSpec;
}
/**
* create an GoToR object.
*
- * @param number the object's number
* @param pdfFileSpec the fileSpec associated with the action
* @param page a page reference within the remote document
*/
- public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec, int page) {
+ public PDFGoToRemote(PDFFileSpec pdfFileSpec, int page) {
/* generic creation of object */
- super(number);
+ super();
this.pdfFileSpec = pdfFileSpec;
this.pageReference = page;
/**
* create an GoToR object.
*
- * @param number the object's number
* @param pdfFileSpec the fileSpec associated with the action
* @param dest a named destination within the remote document
*/
- public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec, String dest) {
+ public PDFGoToRemote(PDFFileSpec pdfFileSpec, String dest) {
/* generic creation of object */
- super(number);
+ super();
this.pdfFileSpec = pdfFileSpec;
this.destination = dest;
}
/**
- * represent the object in PDF
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- String p = new String(this.number + " " + this.generation + " obj\n"
- + "<<\n/S /GoToR\n" + "/F "
- + pdfFileSpec.referencePDF() + "\n");
+ public String toPDFString() {
+ StringBuffer sb = new StringBuffer(64);
+ sb.append(getObjectID());
+ sb.append("<<\n/S /GoToR\n/F " + pdfFileSpec.referencePDF() + "\n");
if (destination != null) {
- p += "/D (" + this.destination + ")";
+ sb.append("/D (" + this.destination + ")");
} else {
- p += "/D [ " + this.pageReference + " /XYZ null null null ]";
+ sb.append("/D [ " + this.pageReference + " /XYZ null null null ]");
}
- p += " \n>>\nendobj\n";
+ sb.append(" \n>>\nendobj\n");
- return p.getBytes();
+ return sb.toString();
}
}
/**
- * there is nothing to return for the toPDF method, as it should not be called
- *
- * @return an empty string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- return new byte[0];
+ protected String toPDFString() {
+ throw new UnsupportedOperationException("This method should not be called");
}
}
/**
* create objects associated with a link annotation (GoToR)
*
- * @param number the object's number
* @param r the rectangle of the link hotspot in absolute coordinates
*/
- public PDFLink(int number, Rectangle2D r) {
+ public PDFLink(Rectangle2D r) {
/* generic creation of PDF object */
- super(number);
+ super();
this.ulx = (float)r.getX();
this.uly = (float)r.getY();
}
/**
- * produce the PDF representation of the object
- *
- * @return the PDF
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- String p = this.number + " " + this.generation + " obj\n"
+ public String toPDFString() {
+ String s = getObjectID()
+ "<< /Type /Annot\n" + "/Subtype /Link\n" + "/Rect [ "
+ (ulx) + " " + (uly) + " "
+ (brx) + " " + (bry) + " ]\n" + "/C [ "
+ this.color + " ]\n" + "/Border [ 0 0 0 ]\n" + "/A "
+ this.action.getAction() + "\n" + "/H /I\n>>\nendobj\n";
- return p.getBytes();
+ return s;
}
/*
*/
package org.apache.fop.pdf;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.util.List;
/**
/**
* Create a PDF outline with the title and action.
*
- * @param number the object id number
* @param title the title of the outline entry (can only be null for root Outlines obj)
* @param action the action for this outline
*/
- public PDFOutline(int number, String title, String action) {
- super(number);
+ public PDFOutline(String title, String action) {
+ super();
subentries = new java.util.ArrayList();
count = 0;
parent = null;
}
/**
- * represent the object in PDF
- *
- * @return the PDF for this outline
+ * @see org.apache.fop.pdf.PDFObject#toPDF()
*/
protected byte[] toPDF() {
- StringBuffer result = new StringBuffer(this.number + " "
- + this.generation
- + " obj\n<<\n");
- if (parent == null) {
- // root Outlines object
- if (first != null && last != null) {
- result.append(" /First " + first.referencePDF() + "\n");
- result.append(" /Last " + last.referencePDF() + "\n");
- // no count... we start with the outline completely closed for now
- }
- } else {
- // subentry Outline object
- result.append(" /Title (" + escapeString(title) + ")\n");
- result.append(" /Parent " + parent.referencePDF() + "\n");
- if (first != null && last != null) {
- result.append(" /First " + first.referencePDF() + "\n");
- result.append(" /Last " + last.referencePDF() + "\n");
- }
- if (prev != null) {
- result.append(" /Prev " + prev.referencePDF() + "\n");
- }
- if (next != null) {
- result.append(" /Next " + next.referencePDF() + "\n");
- }
- if (count > 0) {
- result.append(" /Count -" + count + "\n");
- }
-
- if (actionRef != null) {
- result.append(" /A " + actionRef + "\n");
- }
-
-
- }
- result.append(">> endobj\n");
- return result.toString().getBytes();
-
- }
-
- /**
- * escape string (see 3.8.1 in PDF reference 2nd edition)
- */
- private String escapeString(String s) {
- StringBuffer result = new StringBuffer();
- if (s != null) {
- int l = s.length();
-
- // byte order marker (0xfeff)
- result.append("\\376\\377");
-
- for (int i = 0; i < l; i++) {
- char ch = s.charAt(i);
- int high = (ch & 0xff00) >>> 8;
- int low = ch & 0xff;
- result.append("\\");
- result.append(Integer.toOctalString(high));
- result.append("\\");
- result.append(Integer.toOctalString(low));
+ ByteArrayOutputStream bout = new ByteArrayOutputStream(128);
+ try {
+ bout.write(encode(getObjectID()));
+ bout.write(encode("<<"));
+ if (parent == null) {
+ // root Outlines object
+ if (first != null && last != null) {
+ bout.write(encode(" /First " + first.referencePDF() + "\n"));
+ bout.write(encode(" /Last " + last.referencePDF() + "\n"));
+ // no count... we start with the outline completely closed for now
+ }
+ } else {
+ // subentry Outline object
+ bout.write(encode(" /Title "));
+ bout.write(encodeText(this.title));
+ bout.write(encode("\n"));
+ bout.write(encode(" /Parent " + parent.referencePDF() + "\n"));
+ if (first != null && last != null) {
+ bout.write(encode(" /First " + first.referencePDF() + "\n"));
+ bout.write(encode(" /Last " + last.referencePDF() + "\n"));
+ }
+ if (prev != null) {
+ bout.write(encode(" /Prev " + prev.referencePDF() + "\n"));
+ }
+ if (next != null) {
+ bout.write(encode(" /Next " + next.referencePDF() + "\n"));
+ }
+ if (count > 0) {
+ bout.write(encode(" /Count -" + count + "\n"));
+ }
+
+ if (actionRef != null) {
+ bout.write(encode(" /A " + actionRef + "\n"));
+ }
+
+
}
+ bout.write(encode(">> endobj\n"));
+ } catch (IOException ioe) {
+ getDocumentSafely().getLogger().error("Ignored I/O exception", ioe);
}
-
- return result.toString();
+ return bout.toByteArray();
}
}
*/
protected PDFColorSpace colorSpace;
- /**
- * Create a path paint with a PDF object number.
- *
- * @param theNumber the PDF object number
- */
- public PDFPathPaint(int theNumber) {
- super(theNumber);
- }
-
- /**
- * Create an emty path paint.
- */
- public PDFPathPaint() {
- // do nothing
- }
-
/**
* Get the PDF string for setting the path paint.
*
*/
package org.apache.fop.pdf;
-// Java...
+// Java
import java.util.List;
-import java.util.HashMap;
import java.io.OutputStream;
import java.io.IOException;
/**
* Create a tiling pattern (type 1).
*
- * @param theNumber The object number of this PDF Object
- * @param thePatternName The name of the pattern such as "Pa1" or "Pattern1"
* @param theResources the resources associated with this pattern
* @param thePatternType the type of pattern, which is 1 for tiling.
* @param thePaintType 1 or 2, colored or uncolored.
* @param theXUID Optional vector of Integers that uniquely identify the pattern
* @param thePatternDataStream The stream of pattern data to be tiled.
*/
- public PDFPattern(int theNumber, String thePatternName,
- PDFResources theResources, int thePatternType, // 1
- int thePaintType, int theTilingType, List theBBox, double theXStep,
- double theYStep, List theMatrix, List theXUID,
- StringBuffer thePatternDataStream) {
- super(theNumber);
- this.patternName = thePatternName;
-
+ public PDFPattern(PDFResources theResources, int thePatternType, // 1
+ int thePaintType, int theTilingType, List theBBox,
+ double theXStep, double theYStep,
+ List theMatrix, List theXUID,
+ StringBuffer thePatternDataStream) {
+ super();
this.resources = theResources;
// This next parameter is implicit to all constructors, and is
// not directly passed.
/**
* Create a type 2 pattern (smooth shading)
*
- * @param theNumber the object number of this PDF object
- * @param thePatternName the name of the pattern
* @param thePatternType the type of the pattern, which is 2, smooth shading
* @param theShading the PDF Shading object that comprises this pattern
* @param theXUID optional:the extended unique Identifier if used.
* @param theExtGState optional: the extended graphics state, if used.
* @param theMatrix Optional:List of Doubles that specify the matrix.
*/
- public PDFPattern(int theNumber, String thePatternName,
- int thePatternType, PDFShading theShading,
+ public PDFPattern(int thePatternType, PDFShading theShading,
List theXUID, StringBuffer theExtGState,
List theMatrix) {
- super(theNumber);
-
- this.patternName = thePatternName;
+ super();
this.patternType = 2; // thePatternType;
this.shading = theShading;
return (this.patternName);
}
+ /**
+ * Sets the name of the pattern.
+ * @param name the name of the pattern. Can be anything
+ * without spaces. "Pattern1" or "Pa1" are good examples.
+ */
+ public void setName(String name) {
+ if (name.indexOf(" ") >= 0) {
+ throw new IllegalArgumentException(
+ "Pattern name must not contain any spaces");
+ }
+ this.patternName = name;
+ }
+
/**
* Get the PDF command for setting to this pattern.
*
int vectorSize = 0;
int tempInt = 0;
- StringBuffer p = new StringBuffer();
- p.append(this.number + " " + this.generation
- + " obj\n<< \n/Type /Pattern \n");
+ byte[] buffer;
+ StringBuffer p = new StringBuffer(64);
+ p.append(getObjectID());
+ p.append("<< \n/Type /Pattern \n");
if (this.resources != null) {
p.append("/Resources " + this.resources.referencePDF() + " \n");
p.append("/PatternType " + this.patternType + " \n");
- PDFStream dataStream = null;
+ PDFStream pdfStream = null;
+ StreamCache encodedStream = null;
if (this.patternType == 1) {
p.append("/PaintType " + this.paintType + " \n");
// don't forget the length of the stream.
if (this.patternDataStream != null) {
- dataStream = new PDFStream(0);
- dataStream.add(this.patternDataStream.toString());
- // TODO get the filters from the doc
- dataStream.addDefaultFilters(new HashMap(), PDFStream.CONTENT_FILTER);
- p.append(dataStream.applyFilters());
- p.append("/Length " + (dataStream.getDataLength() + 1)
+ pdfStream = new PDFStream();
+ pdfStream.setDocument(getDocumentSafely());
+ pdfStream.add(this.patternDataStream.toString());
+ pdfStream.getFilterList().addDefaultFilters(
+ getDocument().getFilterMap(),
+ PDFFilterList.CONTENT_FILTER);
+ encodedStream = pdfStream.encodeStream();
+ p.append(pdfStream.getFilterList().buildFilterDictEntries());
+ p.append("/Length " + (encodedStream.getSize() + 1)
+ " \n");
}
p.append(">> \n");
- String dict = p.toString();
- int length = dict.length();
-
- stream.write(dict.getBytes());
+ buffer = encode(p.toString());
+ int length = buffer.length;
+ stream.write(buffer);
// stream representing the function
- if (dataStream != null) {
- length += dataStream.outputStreamData(stream);
+ if (pdfStream != null) {
+ length += pdfStream.outputStreamData(encodedStream, stream);
}
- String end = "endobj\n";
- stream.write(end.getBytes());
- length += end.length();
+ buffer = encode("\nendobj\n");
+ stream.write(buffer);
+ length += buffer.length;
return length;
}
*
* Modified by Mark Lillywhite, mark-fop@inomial.com. The Parent
* object was being referred to by reference, but all that we
- * ever used from the Parent was it's PDF object ID, and according
+ * ever used from the Parent was its PDF object ID, and according
* to the memory profile this was causing OOM issues. So, we store
* only the object ID of the parent, rather than the parent itself.
*/
protected PDFAnnotList annotList;
/**
- * Reference to document used when creating annotation list
- */
- protected PDFDocument document;
-
- /**
- *
- * @param number the object's number
- * @param doc the PDF document this belongs to
+ * Creates a new ResourceContext.
* @param resources the /Resources object
*/
- public PDFResourceContext(int number, PDFDocument doc, PDFResources resources) {
+ public PDFResourceContext(PDFResources resources) {
/* generic creation of object */
- super(number);
+ super();
/* set fields using parameters */
- this.document = doc;
+ //this.document = doc;
this.resources = resources;
this.annotList = null;
}
*/
public void addAnnotation(PDFObject annot) {
if (this.annotList == null) {
- this.annotList = document.makeAnnotList();
+ this.annotList = getDocument().getFactory().makeAnnotList();
}
this.annotList.addAnnot(annot);
}
* @param gstate the GState to add
*/
public void addGState(PDFGState gstate) {
- this.resources.addGState(gstate);
+ getPDFResources().addGState(gstate);
}
/**
- * Add the shading tot he current resource context.
+ * Add the shading to the current resource context.
*
* @param shading the shading to add
*/
public void addShading(PDFShading shading) {
- this.resources.addShading(shading);
+ getPDFResources().addShading(shading);
}
- /**
- * Get the PDF, unused.
- *
- * @return null value
- */
- public byte[] toPDF() {
- return null;
- }
}
/**
* create a /Resources object.
*
- * @param number the object's number
+ * @param objnum the object's number
*/
- public PDFResources(int number) {
+ public PDFResources(int objnum) {
/* generic creation of object */
- super(number);
+ super();
+ setObjectNumber(objnum);
}
/**
* resource context.
*
* @return the PDF
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer(this.number + " " + this.generation
- + " obj\n<< \n");
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID() + "<<\n");
if (!this.fonts.isEmpty()) {
- p.append("/Font << ");
+ p.append("/Font <<\n");
/* construct PDF dictionary of font object references */
Iterator fontIterator = this.fonts.keySet().iterator();
while (fontIterator.hasNext()) {
String fontName = (String)fontIterator.next();
- p.append("/" + fontName + " "
+ p.append(" /" + fontName + " "
+ ((PDFFont)this.fonts.get(fontName)).referencePDF()
- + " ");
+ + "\n");
}
- p.append(">> \n");
+ p.append(">>\n");
}
PDFShading currentShading = null;
if (!this.shadings.isEmpty()) {
- p.append("/Shading << ");
+ p.append("/Shading <<\n");
for (Iterator iter = shadings.iterator(); iter.hasNext();) {
currentShading = (PDFShading)iter.next();
- p.append("/" + currentShading.getName() + " "
+ p.append(" /" + currentShading.getName() + " "
+ currentShading.referencePDF() + " "); // \n ??????
}
PDFPattern currentPattern = null;
if (!this.patterns.isEmpty()) {
- p.append("/Pattern << ");
+ p.append("/Pattern <<\n");
for (Iterator iter = patterns.iterator(); iter.hasNext();) {
currentPattern = (PDFPattern)iter.next();
- p.append("/" + currentPattern.getName() + " "
+ p.append(" /" + currentPattern.getName() + " "
+ currentPattern.referencePDF() + " ");
}
- p.append(">> \n");
+ p.append(">>\n");
}
// "free" the memory. Sorta.
currentPattern = null;
- p.append("/ProcSet [ /PDF /ImageC /Text ]\n");
+ p.append("/ProcSet [ /PDF /ImageB /ImageC /Text ]\n");
if (this.xObjects != null && !this.xObjects.isEmpty()) {
- p = p.append("/XObject <<");
+ p = p.append("/XObject <<\n");
for (Iterator iter = xObjects.iterator(); iter.hasNext();) {
PDFXObject xobj = (PDFXObject)iter.next();
- p = p.append("/Im" + xobj.getXNumber() + " "
+ p = p.append(" /Im" + xobj.getXNumber() + " "
+ xobj.referencePDF()
+ "\n");
}
- p = p.append(" >>\n");
+ p = p.append(">>\n");
}
if (!this.gstates.isEmpty()) {
- p = p.append("/ExtGState <<");
+ p = p.append("/ExtGState <<\n");
for (Iterator iter = gstates.iterator(); iter.hasNext();) {
PDFGState gs = (PDFGState)iter.next();
- p = p.append("/" + gs.getName() + " "
+ p = p.append(" /" + gs.getName() + " "
+ gs.referencePDF()
- + " ");
+ + "\n");
}
p = p.append(">>\n");
}
p = p.append(">>\nendobj\n");
- return p.toString().getBytes();
+ return p.toString();
}
}
* it is about to be written (immediately before the xref
* table as part of the trsailer). (mark-fop@inomial.com)
*
- * @param number the object's number
+ * @param objnum the object's number
* @param pages the PDFPages object
*/
- public PDFRoot(int number, PDFPages pages) {
- super(number);
+ public PDFRoot(int objnum, PDFPages pages) {
+ super();
+ setObjectNumber(objnum);
setRootPages(pages);
}
}
/**
- * represent the object as PDF.
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer(this.number + " " + this.generation
- + " obj\n<< /Type /Catalog\n/Pages "
- + this.rootPages.referencePDF()
- + "\n");
+ public String toPDFString() {
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID());
+ p.append("<< /Type /Catalog\n/Pages "
+ + this.rootPages.referencePDF()
+ + "\n");
if (outline != null) {
p.append(" /Outlines " + outline.referencePDF() + "\n");
p.append(" /PageMode /UseOutlines\n");
break;
}
}
- p.append(" >>\nendobj\n");
- return p.toString().getBytes();
+ p.append(">>\nendobj\n");
+ return p.toString();
}
}
/**
* Constructor for type function based shading
*
- * @param theNumber The object number of this PDF object
- * @param theShadingName The name of the shading pattern. Can be anything
- * without spaces. "Shading1" or "Sh1" are good examples.
* @param theShadingType The type of shading object, which should be 1 for function
* based shading.
* @param theColorSpace The colorspace is 'DeviceRGB' or something similar.
* It's optional, the default is the identity matrix
* @param theFunction The PDF Function that maps an (x,y) location to a color
*/
- public PDFShading(int theNumber, String theShadingName,
- int theShadingType, PDFColorSpace theColorSpace,
+ public PDFShading(int theShadingType, PDFColorSpace theColorSpace,
List theBackground, List theBBox,
boolean theAntiAlias, List theDomain,
List theMatrix, PDFFunction theFunction) {
- super(theNumber);
- this.shadingName = theShadingName;
+ super();
this.shadingType = theShadingType; // 1
this.colorSpace = theColorSpace;
this.background = theBackground;
/**
* Constructor for Type 2 and 3
*
- * @param theNumber The object number of this PDF object.
- * @param theShadingName The name of the shading pattern. Can be anything
- * without spaces. "Shading1" or "Sh1" are good examples.
* @param theShadingType 2 or 3 for axial or radial shading
* @param theColorSpace "DeviceRGB" or similar.
* @param theBackground theBackground An array of color components appropriate to the
* and end colors past the start and end points
* The default is [false, false]
*/
- public PDFShading(int theNumber, String theShadingName,
- int theShadingType, PDFColorSpace theColorSpace,
+ public PDFShading(int theShadingType, PDFColorSpace theColorSpace,
List theBackground, List theBBox,
boolean theAntiAlias, List theCoords,
List theDomain, PDFFunction theFunction,
List theExtend) {
- super(theNumber);
- this.shadingName = theShadingName;
+ super();
this.shadingType = theShadingType; // 2 or 3
this.colorSpace = theColorSpace;
this.background = theBackground;
/**
* Constructor for Type 4,6, or 7
*
- * @param theNumber The object number of this PDF object.
* @param theShadingType 4, 6, or 7 depending on whether it's
* Free-form gouraud-shaded triangle meshes, coons patch meshes,
* or tensor product patch meshes, respectively.
- * @param theShadingName The name of the shading pattern. Can be anything
- * without spaces. "Shading1" or "Sh1" are good examples.
* @param theColorSpace "DeviceRGB" or similar.
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* @param theDecode List of Doubles see PDF 1.3 spec pages 303 to 312.
* @param theFunction the PDFFunction
*/
- public PDFShading(int theNumber, String theShadingName,
- int theShadingType, PDFColorSpace theColorSpace,
+ public PDFShading(int theShadingType, PDFColorSpace theColorSpace,
List theBackground, List theBBox,
boolean theAntiAlias, int theBitsPerCoordinate,
int theBitsPerComponent, int theBitsPerFlag,
List theDecode, PDFFunction theFunction) {
- super(theNumber);
+ super();
this.shadingType = theShadingType; // 4,6 or 7
this.colorSpace = theColorSpace;
* Constructor for type 5
*
* @param theShadingType 5 for lattice-Form Gouraud shaded-triangle mesh
- * @param theShadingName The name of the shading pattern. Can be anything
- * without spaces. "Shading1" or "Sh1" are good examples.
* @param theColorSpace "DeviceRGB" or similar.
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* @param theDecode List of Doubles. See page 305 in PDF 1.3 spec.
* @param theVerticesPerRow number of vertices in each "row" of the lattice.
* @param theFunction The PDFFunction that's mapped on to this shape
- * @param theNumber the object number of this PDF object.
*/
- public PDFShading(int theNumber, String theShadingName,
- int theShadingType, PDFColorSpace theColorSpace,
+ public PDFShading(int theShadingType, PDFColorSpace theColorSpace,
List theBackground, List theBBox,
boolean theAntiAlias, int theBitsPerCoordinate,
int theBitsPerComponent, List theDecode,
int theVerticesPerRow, PDFFunction theFunction) {
- super(theNumber);
- this.shadingName = theShadingName;
+ super();
this.shadingType = theShadingType; // 5
this.colorSpace = theColorSpace;
this.background = theBackground;
return (this.shadingName);
}
+ /**
+ * Sets the name of the shading
+ * @param name the name of the shading pattern. Can be anything
+ * without spaces. "Shading1" or "Sh1" are good examples.
+ */
+ public void setName(String name) {
+ if (name.indexOf(" ") >= 0) {
+ throw new IllegalArgumentException(
+ "Shading name must not contain any spaces");
+ }
+ this.shadingName = name;
+ }
+
/**
* represent as PDF. Whatever the shadingType is, the correct
* representation spits out. The sets of required and optional
*
* @return the PDF string.
*/
- public byte[] toPDF() {
+ public String toPDFString() {
int vectorSize;
int tempInt;
- StringBuffer p = new StringBuffer();
- p.append(this.number + " " + this.generation
- + " obj\n<< \n/ShadingType " + this.shadingType + " \n");
+ StringBuffer p = new StringBuffer(128);
+ p.append(getObjectID()
+ + "<< \n/ShadingType " + this.shadingType + " \n");
if (this.colorSpace != null) {
p.append("/ColorSpace /"
+ this.colorSpace.getColorSpacePDFString() + " \n");
p.append(">> \nendobj\n");
- return (p.toString().getBytes());
+ return (p.toString());
}
/**
PDFGState defaultState = PDFGState.DEFAULT;
PDFGState state;
- PDFGState newstate = new PDFGState(0);
+ PDFGState newstate = new PDFGState();
newstate.addValues(defaultState);
for (Iterator iter = stateStack.iterator(); iter.hasNext();) {
HashMap map = (HashMap)iter.next();