/** * Write out the string just uncompressed. */ public void writeString(byte string[]) { try { uncompData.write(string); } catch (IOException e) { throw new ExceptionConverter(e); } }
/** * Write out the string just uncompressed. */ public void writeString(byte string[]) { try { uncompData.write(string); } catch (IOException e) { throw new ExceptionConverter(e); } }
public static void inflate(byte[] deflated, byte[] inflated) { Inflater inflater = new Inflater(); inflater.setInput(deflated); try { inflater.inflate(inflated); } catch(DataFormatException dfe) { throw new ExceptionConverter(dfe); } }
public static Image getGifImage(URL url) { try { InputStream is = url.openStream(); BufferedImage bufferedImage = ImageIO.read(is); is.close(); return Image.getInstance(bufferedImage, null, false); } catch (Exception e) { throw new ExceptionConverter(e); } }
public static Image getGifImage(byte[] imageData) { try { BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(imageData)); return Image.getInstance(bufferedImage, null, false); } catch (Exception e) { throw new ExceptionConverter(e); } }
/** * Gets the page label dictionary to insert into the document. * * @return the page label dictionary */ PdfDictionary getDictionary(PdfWriter writer) { try { return PdfNumberTree.writeTree(map, writer); } catch (IOException e) { throw new ExceptionConverter(e); } }
PdfIndirectReference addPageRef(PdfIndirectReference pageRef) { try { if ((pages.size() % leafSize) == 0) parents.add(writer.getPdfIndirectReference()); pages.add(pageRef); return (PdfIndirectReference)parents.get(parents.size() - 1); } catch (Exception e) { throw new ExceptionConverter(e); } }
short getShort() { try { return buf.readShort(); } catch (Exception e) { throw new ExceptionConverter(e); } }
protected void init(InputStream in) { try { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(new InputSource(in), new AttributeHandler(this)); } catch(Exception e) { throw new ExceptionConverter(e); } }
protected void init(InputStream in) { try { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(new InputSource(in), new AttributeHandler(this)); } catch(Exception e) { throw new ExceptionConverter(e); } }
/** Gets the number of pages the TIFF document has. * @param s the file source * @return the number of pages */ public static int getNumberOfPages(RandomAccessFileOrArray s) { try { return TIFFDirectory.getNumDirectories(s); } catch (Exception e) { throw new ExceptionConverter(e); } }
public PdfEncryption() { try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } publicKeyHandler = new PdfPublicKeySecurityHandler(); }
char getCard8() { try { byte i = buf.readByte(); return (char)(i & 0xff); } catch (Exception e) { throw new ExceptionConverter(e); } }
char getCard16() { try { return buf.readChar(); } catch (Exception e) { throw new ExceptionConverter(e); } }
public void endDocument() { try { for (int k = 0; k < stack.size(); ++k) document.add((Element) stack.elementAt(k)); if (currentParagraph != null) document.add(currentParagraph); currentParagraph = null; } catch (Exception e) { throw new ExceptionConverter(e); } }
public byte[] encryptByteArray(byte[] b) { try { ByteArrayOutputStream ba = new ByteArrayOutputStream(); OutputStreamEncryption os2 = getEncryptionStream(ba); os2.write(b); os2.finish(); return ba.toByteArray(); } catch (IOException ex) { throw new ExceptionConverter(ex); } }
void addJavaScript(String name, PdfAction js) { if (js.get(PdfName.JS) == null) throw new RuntimeException("Only JavaScript actions are allowed."); try { documentLevelJS.put(name, writer.addToBody(js).getIndirectReference()); } catch (IOException e) { throw new ExceptionConverter(e); } }
PdfIndirectReference getReference() { try { if (reference == null) { reference = writer.addToBody(dictionary).getIndirectReference(); } } catch (IOException ioe) { throw new ExceptionConverter(ioe); } return reference; }
static PdfFont getDefaultFont() { try { BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false); return new PdfFont(bf, 12); } catch (Exception ee) { throw new ExceptionConverter(ee); } } void setHorizontalScaling(float hScale) {
/** * Sets the document level additional actions. * @param actions dictionary of actions */ void setAdditionalActions(PdfDictionary actions) { try { put(PdfName.AA, writer.addToBody(actions).getIndirectReference()); } catch (Exception e) { throw new ExceptionConverter(e); } } }