public void setEncryption(Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException { if (stamper.isAppend()) throw new DocumentException("Append mode does not support changing the encryption status."); if (stamper.isContentWritten()) throw new DocumentException("Content was already written to the output."); stamper.setEncryption(certs, permissions, encryptionType); }
public void setEncryption( byte userPassword[], byte ownerPassword[], int permissions, int encryptionType) throws DocumentException { if (stamper.isAppend()) throw new DocumentException("Append mode does not support changing the encryption status."); if (stamper.isContentWritten()) throw new DocumentException("Content was already written to the output."); stamper.setEncryption(userPassword, ownerPassword, permissions, encryptionType); }
public void setEncryption( byte userPassword[], byte ownerPassword[], int permissions, boolean strength128Bits) throws DocumentException { if (stamper.isAppend()) throw new DocumentException("Append mode does not support changing the encryption status."); if (stamper.isContentWritten()) throw new DocumentException("Content was already written to the output."); stamper.setEncryption( userPassword, ownerPassword, permissions, strength128Bits ? PdfWriter.STANDARD_ENCRYPTION_128 : PdfWriter.STANDARD_ENCRYPTION_40); }
public void close() throws DocumentException, IOException { if (!hasSignature) { stamper.close(moreInfo); return; } sigApp.preClose(); PdfSigGenericPKCS sig = sigApp.getSigStandard(); PdfLiteral lit = (PdfLiteral) sig.get(PdfName.CONTENTS); int totalBuf = (lit.getPosLength() - 2) / 2; byte buf[] = new byte[8192]; int n; InputStream inp = sigApp.getRangeStream(); try { while ((n = inp.read(buf)) > 0) { sig.getSigner().update(buf, 0, n); } } catch (SignatureException se) { throw new ExceptionConverter(se); } buf = new byte[totalBuf]; byte[] bsig = sig.getSignerContents(); System.arraycopy(bsig, 0, buf, 0, bsig.length); PdfString str = new PdfString(buf); str.setHexWriting(true); PdfDictionary dic = new PdfDictionary(); dic.put(PdfName.CONTENTS, str); sigApp.close(dic); stamper.reader.close(); }
public PdfFormField addSignature( String name, int page, float llx, float lly, float urx, float ury) { PdfAcroForm acroForm = stamper.getAcroForm(); PdfFormField signature = PdfFormField.createSignature(stamper); acroForm.setSignatureParams(signature, name, llx, lly, urx, ury); acroForm.drawSignatureAppearences(signature, llx, lly, urx, ury); addAnnotation(signature, page); return signature; }
static void mergeResources(PdfDictionary result, PdfDictionary source, PdfStamperImp writer) { PdfDictionary dic = null; PdfDictionary res = null; PdfName target = null; for (int k = 0; k < mergeTarget.length; ++k) { target = mergeTarget[k]; PdfDictionary pdfDict = source.getAsDict(target); if ((dic = pdfDict) != null) { if ((res = (PdfDictionary) PdfReader.getPdfObject(result.get(target), result)) == null) { res = new PdfDictionary(); } res.mergeDifferent(dic); result.put(target, res); if (writer != null) writer.markUsed(res); } } }
public void setTransition(PdfTransition transition, int page) { stamper.setTransition(transition, page); }
public void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException { stamper.setPageAction(actionType, action, page); }
public void setDuration(int seconds, int page) { stamper.setDuration(seconds, page); }
void addAnnotation(PdfAnnotation annot) { ((PdfStamperImp) writer).addAnnotation(annot, ps.pageN); }
public void setOutlines(List outlines) { stamper.setOutlines(outlines); }
public void insertPage(int pageNumber, Rectangle mediabox) { stamper.insertPage(pageNumber, mediabox); }
public PdfContentByte getOverContent(int pageNum) { return stamper.getOverContent(pageNum); }
public void makePackage(PdfCollection collection) { stamper.makePackage(collection); }
public void setViewerPreferences(int preferences) { stamper.setViewerPreferences(preferences); }
public void addFileAttachment(String description, PdfFileSpecification fs) throws IOException { stamper.addFileAttachment(description, fs); }
public void makePackage(PdfName initialView) { PdfCollection collection = new PdfCollection(0); collection.put(PdfName.VIEW, initialView); stamper.makePackage(collection); }
public void addJavaScript(String js) { stamper.addJavaScript(js, !PdfEncodings.isPdfDocEncoding(js)); }
public boolean partialFormFlattening(String name) { return stamper.partialFormFlattening(name); }
public void setThumbnail(Image image, int page) throws PdfException, DocumentException { stamper.setThumbnail(image, page); }
public Map getPdfLayers() { return stamper.getPdfLayers(); }
public void addAnnotation(PdfAnnotation annot, int page) { stamper.addAnnotation(annot, page); }
public void replacePage(PdfReader r, int pageImported, int pageReplaced) { stamper.replacePage(r, pageImported, pageReplaced); }
public void setXmpMetadata(byte[] xmp) { stamper.setXmpMetadata(xmp); }
public void setFreeTextFlattening(boolean flat) { stamper.setFreeTextFlattening(flat); }
public boolean isFullCompression() { return stamper.isFullCompression(); }
public void setAction(PdfAction action, float llx, float lly, float urx, float ury) { ((PdfStamperImp) writer) .addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action), ps.pageN); }
public void setFullCompression() { if (stamper.isAppend()) return; stamper.setFullCompression(); }
public void addViewerPreference(PdfName key, PdfObject value) { stamper.addViewerPreference(key, value); }
public void addComments(FdfReader fdf) throws IOException { stamper.addComments(fdf); }