Package com.lowagie.text

Examples of com.lowagie.text.DocumentException


    public void addDocument(PdfReader reader) throws Exception {
        if (reader != null) {
            writer.addDocument(reader);
        } else {
            throw new DocumentException("Reader is null");
        }
    }
View Full Code Here


    public void addDocument(PdfReader reader, String ranges) throws Exception {
        if (reader != null) {
            reader.selectPages(ranges);
            addDocument(reader);
        } else {
            throw new DocumentException("Reader is null");
        }
    }
View Full Code Here

            int numPages = reader.getNumberOfPages();
            for (int count = 1; count <= numPages; count++) {
                writer.addPage(writer.getImportedPage(reader, count));
            }
        } else {
            throw new DocumentException("Reader is null");
        }
    }
View Full Code Here

        f = BaseFont.createFont(filename, stringEncoding, embedded, false, null, null);
      }
    }
    catch (IOException ioe)
    {
      throw new DocumentException("Failed to read the font: " + ioe);
    }

    // no, we have to create a new instance
    final BaseFontRecord record = new BaseFontRecord
        (filename, true, embedded, f, fontRecord.isBold(), fontRecord.isItalic());
View Full Code Here

     * @see RtfParser#importRtfDocument(InputStream, RtfDocument)
     * @since 2.0.8
     */
    public void importRtfDocument(InputStream documentSource, EventListener[] events ) throws IOException, DocumentException {
        if(!this.open) {
            throw new DocumentException("The document must be open to import RTF documents.");
        }
      RtfParser rtfImport = new RtfParser(this.document);
      if(events != null) {
        for(int idx=0;idx<events.length;idx++) {
            rtfImport.addListener(events[idx]);
View Full Code Here

     * @see RtfParser#importRtfFragment(InputStream, RtfDocument, RtfImportMappings)
     * @since 2.0.8
     */
    public void importRtfFragment(InputStream documentSource, RtfImportMappings mappings, EventListener[] events ) throws IOException, DocumentException {
        if(!this.open) {
            throw new DocumentException("The document must be open to import RTF fragments.");
        }
      RtfParser rtfImport = new RtfParser(this.document);
      if(events != null) {
        for(int idx=0;idx<events.length;idx++) {
            rtfImport.addListener(events[idx]);
View Full Code Here

    public boolean add(LwgElement element) throws DocumentException {
        if (pause) {
            return false;
        }
        if (open && !element.isContent()) {
        throw new DocumentException(MessageLocalization.getComposedMessage("the.document.is.open.you.can.only.add.elements.with.content"));
        }
        try {
            switch(element.type()) {
                case LwgElement.HEADER:
                    try {
View Full Code Here

      // we retrieve the total number of pages
      int n = reader.getNumberOfPages();
      System.out.println("There are " + n + " pages in the original file.");

      if (pagenumber < 2 || pagenumber > n) {
        throw new DocumentException("You can't split this document at page " + pagenumber + "; there is no such page.");
      }

      // step 1: creation of a document-object
      LwgDocument document1 = new LwgDocument(reader.getPageSizeWithRotation(1));
      LwgDocument document2 = new LwgDocument(reader.getPageSizeWithRotation(pagenumber));
View Full Code Here

        // we retrieve the total number of pages
        int n = reader.getNumberOfPages();
        System.out.println("There are " + n + " pages in the original file.");
               
        if (pagenumber < 2 || pagenumber > n) {
          throw new DocumentException(MessageLocalization.getComposedMessage("you.can.t.split.this.document.at.page.1.there.is.no.such.page", pagenumber));
        }
               
        // step 1: creation of a document-object
        LwgDocument document1 = new LwgDocument(reader.getPageSizeWithRotation(1));
        LwgDocument document2 = new LwgDocument(reader.getPageSizeWithRotation(pagenumber));
View Full Code Here

    }
    else {
      try {
        int pages = Integer.parseInt(args[2]);
        if (pages < 2 || pages > 8) {
          throw new DocumentException(MessageLocalization.getComposedMessage("you.can.t.have.1.pages.on.one.page.minimum.2.maximum.8", pages));
        }
               
        float x1 = 30f;
        float x2 = 280f;
        float x3 = 320f;
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.