/** * Sets the file name (the key /F) string as an hex representation * to support multi byte file names. The name must have the slash and * backslash escaped according to the file specification rules * @param fileName the file name as a byte array */ public void setMultiByteFileName(byte fileName[]) { put(PdfName.F, new PdfString(fileName).setHexWriting(true)); }
/** * Sets the file name (the key /F) string as an hex representation * to support multi byte file names. The name must have the slash and * backslash escaped according to the file specification rules * @param fileName the file name as a byte array */ public void setMultiByteFileName(byte fileName[]) { put(PdfName.F, new PdfString(fileName).setHexWriting(true)); }
public void setContents(byte contents[]) { put(PdfName.CONTENTS, new PdfString(contents).setHexWriting(true)); }
public void setContents(byte contents[]) { put(PdfName.CONTENTS, new PdfString(contents).setHexWriting(true)); }
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); sap.close(dic2);
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); sap.close(dic2);
void addRange(PdfString from, PdfString to, PdfObject code) { byte[] a1 = decodeStringToByte(from); byte[] a2 = decodeStringToByte(to); if (a1.length != a2.length || a1.length == 0) throw new IllegalArgumentException("Invalid map."); byte[] sout = null; if (code instanceof PdfString) sout = decodeStringToByte((PdfString)code); int start = byteArrayToInt(a1); int end = byteArrayToInt(a2); for (int k = start; k <= end; ++k) { intToByteArray(k, a1); PdfString s = new PdfString(a1); s.setHexWriting(true); if (code instanceof PdfArray) { addChar(s, ((PdfArray)code).getPdfObject(k - start)); } else if (code instanceof PdfNumber) { int nn = ((PdfNumber)code).intValue() + k - start; addChar(s, new PdfNumber(nn)); } else if (code instanceof PdfString) { PdfString s1 = new PdfString(sout); s1.setHexWriting(true); ++sout[sout.length - 1]; addChar(s, s1); } } }
void addRange(PdfString from, PdfString to, PdfObject code) { byte[] a1 = decodeStringToByte(from); byte[] a2 = decodeStringToByte(to); if (a1.length != a2.length || a1.length == 0) throw new IllegalArgumentException("Invalid map."); byte[] sout = null; if (code instanceof PdfString) sout = decodeStringToByte((PdfString)code); int start = byteArrayToInt(a1); int end = byteArrayToInt(a2); for (int k = start; k <= end; ++k) { intToByteArray(k, a1); PdfString s = new PdfString(a1); s.setHexWriting(true); if (code instanceof PdfArray) { addChar(s, ((PdfArray)code).getPdfObject(k - start)); } else if (code instanceof PdfNumber) { int nn = ((PdfNumber)code).intValue() + k - start; addChar(s, new PdfNumber(nn)); } else if (code instanceof PdfString) { PdfString s1 = new PdfString(sout); s1.setHexWriting(true); ++sout[sout.length - 1]; addChar(s, s1); } } }
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); sap.close(dic2);
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); sap.close(dic2);
return new PdfNumber(tokens.getStringValue()); case STRING: PdfString str = new PdfString(tokens.getStringValue(), null).setHexWriting(tokens.isHexString());
return new PdfNumber(tokens.getStringValue()); case STRING: PdfString str = new PdfString(tokens.getStringValue(), null).setHexWriting(tokens.isHexString());
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); sap.close(dic2);
dic2.put(PdfName.CONTENTS, new PdfString(paddedSig).setHexWriting(true)); sap.close(dic2);
/** * Reads a pdf object. * @return the pdf object * @throws IOException on error */ public PdfObject readPRObject() throws IOException { if (!nextValidToken()) return null; TokenType type = tokeniser.getTokenType(); switch (type) { case START_DIC: { PdfDictionary dic = readDictionary(); return dic; } case START_ARRAY: return readArray(); case STRING: PdfString str = new PdfString(tokeniser.getStringValue(), null).setHexWriting(tokeniser.isHexString()); return str; case NAME: return new PdfName(tokeniser.getStringValue(), false); case NUMBER: return new PdfNumber(tokeniser.getStringValue()); case OTHER: return new PdfLiteral(COMMAND_TYPE, tokeniser.getStringValue()); default: return new PdfLiteral(-type.ordinal(), tokeniser.getStringValue()); } }
/** * Reads a pdf object. * @return the pdf object * @throws IOException on error */ public PdfObject readPRObject() throws IOException { if (!nextValidToken()) return null; TokenType type = tokeniser.getTokenType(); switch (type) { case START_DIC: { PdfDictionary dic = readDictionary(); return dic; } case START_ARRAY: return readArray(); case STRING: PdfString str = new PdfString(tokeniser.getStringValue(), null).setHexWriting(tokeniser.isHexString()); return str; case NAME: return new PdfName(tokeniser.getStringValue(), false); case NUMBER: return new PdfNumber(tokeniser.getStringValue()); case OTHER: return new PdfLiteral(COMMAND_TYPE, tokeniser.getStringValue()); default: return new PdfLiteral(-type.ordinal(), tokeniser.getStringValue()); } }