public String getInitSave() { System.out.println("getInitSave..."); BASE64Encoder b64en = new BASE64Encoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { getPDFNotes().saveDocument(baos); storeSave = b64en.encodeBuffer(baos.toByteArray()); position = 0; } catch (IOException e) { e.printStackTrace(); } catch (PDFException e) { e.printStackTrace(); } return "" + storeSave.length(); }
public void showPDF(String params) { System.out.println("showPDF(String)-ICSfs jPDF build version:" + version); IcsOracleFormPropertiesMsg message = IcsOracleFormMessages.decypherIcsOracleFormPrpertiesMsg(params); System.out.println("incoming properties msg:" + params); System.out.println("properties object:" + message); Locale.setDefault(new Locale(message.getLanguage())); setUserLanguage(message.getLanguage()); try { setPDFNotes((IcsPdfNotesBean) this.getComponent(0)); remove(this.getComponent(0)); } catch (ArrayIndexOutOfBoundsException e) { // ignore } getPDFNotes().setProperties(message); getPDFNotes().setDocument(null); BASE64Decoder b64dc = new BASE64Decoder(); byte[] b; try { b = b64dc.decodeBuffer(sb.toString()); if (b.length > 0 && !message.getMode().equals(IcsPdfNotesBean.MODE_CREATE)) { // b = b64dc.decodeBuffer(new ByteArrayInputStream(sb.toString().getBytes("UTF-8"))); getPDFNotes().loadPDF(new ByteArrayInputStream(b)); } else { System.err.println(" --- No Files was loaded in the application"); // TODO: uncomment for testing // getPDFNotes().loadPDF("d:/test.pdf"); } } catch (IOException e) { e.printStackTrace(); } catch (PDFException e) { e.printStackTrace(); } removeAll(); this.add(getPDFNotes(), BorderLayout.CENTER, 0); repaint(); }
public void loadDocument(String loadDoc) { System.out.println("loadDocument()..."); if (loadDoc.startsWith("http:")) { try { getPDFNotes().loadPDF(new URL(loadDoc)); } catch (PDFException e) { e.printStackTrace(); System.exit(1); } catch (MalformedURLException e) { e.printStackTrace(); System.exit(1); } } else { try { getPDFNotes().loadPDF(loadDoc); } catch (PDFException e) { e.printStackTrace(); System.exit(1); } } }