Package com.lowagie.text

Examples of com.lowagie.text.DocumentException


    PdfStamperImp(PdfReader reader, OutputStream os, char pdfVersion, boolean append) throws DocumentException, IOException {
        super(new PdfDocument(), os);
        if (!reader.isOpenedWithFullPermissions())
            throw new BadPasswordException(MessageLocalization.getComposedMessage("pdfreader.not.opened.with.owner.password"));
        if (reader.isTampered())
            throw new DocumentException(MessageLocalization.getComposedMessage("the.original.document.was.reused.read.it.again.from.file"));
        reader.setTampered(true);
        this.reader = reader;
        file = reader.getSafeFile();
        this.append = append;
        if (append) {
            if (reader.isRebuilt())
                throw new DocumentException(MessageLocalization.getComposedMessage("append.mode.requires.a.document.without.errors.even.if.recovery.was.possible"));
            if (reader.isEncrypted())
                crypto = new PdfEncryption(reader.getDecrypt());
            pdf_version.setAppendmode(true);
            file.reOpen();
            byte buf[] = new byte[8192];
View Full Code Here


        } else if (element instanceof LwgPhrase) {
            columnText.addText((LwgPhrase) element);
        } else if (element instanceof Chunk) {
            columnText.addText((Chunk) element);
        } else {
            throw new DocumentException(MessageLocalization.getComposedMessage("can.t.add.1.to.multicolumntext.with.complex.columns", element.getClass()));
        }
    }
View Full Code Here

     */
    public float write(PdfContentByte canvas, PdfDocument document, float documentY) throws DocumentException {
        this.document = document;
        columnText.setCanvas(canvas);
        if (columnDefs.isEmpty()) {
            throw new DocumentException(MessageLocalization.getComposedMessage("multicolumntext.has.no.columns"));
        }
        overflow = false;
        float currentHeight = 0;
        boolean done = false;
        try {
View Full Code Here

                  ImgWMF wmf = (ImgWMF) image;
                  wmf.readWMF(PdfTemplate.createTemplate(this, 0, 0));
               }
               catch (Exception e)
               {
                  throw new DocumentException(e);
               }
            }
         }
         else
         {
View Full Code Here

    * @throws  DocumentException  if you try setting the leading after the document was opened.
    */
   public void setInitialLeading(float leading) throws DocumentException
   {
      if (open)
         throw new DocumentException(MessageLocalization.getComposedMessage("you.can.t.set.the.initial.leading.if.the.document.is.already.open"));
      pdf.setLeading(leading);
   }
View Full Code Here

              || actionType.equals(WILL_SAVE)
              || actionType.equals(DID_SAVE)
              || actionType.equals(WILL_PRINT)
              || actionType.equals(DID_PRINT)))
      {
         throw new DocumentException(MessageLocalization.getComposedMessage("invalid.additional.action.type.1", actionType.toString()));
      }
      pdf.addAdditionalAction(actionType, action);
   }
View Full Code Here

   /** @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int) */
   public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, int encryptionType) throws DocumentException
   {
      if (pdf.isOpen())
         throw new DocumentException(MessageLocalization.getComposedMessage("encryption.can.only.be.added.before.opening.the.document"));
      crypto = new PdfEncryption();
      crypto.setCryptoMode(encryptionType, 0);
      crypto.setupAllKeys(userPassword, ownerPassword, permissions);
   }
View Full Code Here

   /** @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int) */
   public void setEncryption(Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException
   {
      if (pdf.isOpen())
         throw new DocumentException(MessageLocalization.getComposedMessage("encryption.can.only.be.added.before.opening.the.document"));
      crypto = new PdfEncryption();
      if (certs != null)
      {
         for (int i = 0; i < certs.length; i++)
         {
View Full Code Here

   /** @see com.lowagie.text.pdf.interfaces.PdfPageActions#setPageAction(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfAction) */
   public void setPageAction(PdfName actionType, PdfAction action) throws DocumentException
   {
      if (!actionType.equals(PAGE_OPEN) && !actionType.equals(PAGE_CLOSE))
         throw new DocumentException(MessageLocalization.getComposedMessage("invalid.page.additional.action.type.1", actionType.toString()));
      pdf.setPageAction(actionType, action);
   }
View Full Code Here

    * @throws DocumentException on error
    */
   public void setUserunit(float userunit) throws DocumentException
   {
      if (userunit < 1f || userunit > 75000f)
         throw new DocumentException(MessageLocalization.getComposedMessage("userunit.should.be.a.value.between.1.and.75000"));
      this.userunit = userunit;
      setAtLeastPdfVersion(VERSION_1_6);
   }
View Full Code Here

TOP

Related Classes of com.lowagie.text.DocumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.