Package com.lowagie.text

Examples of com.lowagie.text.DocumentException


            if (getValue("backgroundcolor") != null) pageSize.setBackgroundColor((Color)getValue("backgroundcolor"));
            LwgDocument document = new LwgDocument(pageSize);
            // step 2:
            // we create a writer that listens to the document
            // and directs a PDF-stream to a file
          if (getValue("destfile") == null) throw new DocumentException("You must provide a destination file!");
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream((File)getValue("destfile")));

            // step 3: we open the document
            document.open();
View Full Code Here


    {
        super(doc);
        imageType = image.getOriginalType();
        if (!(imageType == LwgImage.ORIGINAL_JPEG || imageType == LwgImage.ORIGINAL_BMP
                || imageType == LwgImage.ORIGINAL_PNG || imageType == LwgImage.ORIGINAL_WMF || imageType == LwgImage.ORIGINAL_GIF)) {
            throw new DocumentException(MessageLocalization.getComposedMessage("only.bmp.png.wmf.gif.and.jpeg.images.are.supported.by.the.rtf.writer"));
        }
        alignment = image.getAlignment();
        width = image.getWidth();
        height = image.getHeight();
        plainWidth = image.getPlainWidth();
View Full Code Here

            }
           
            return bab.toByteArrayArray();
           
        } catch(IOException ioe) {
            throw new DocumentException(ioe.getMessage());
        }
    }
View Full Code Here

        else if (isCJKFont)
            fontBuilt = new CJKFont(name, encoding, embedded);
        else if (noThrow)
            return null;
        else
            throw new DocumentException(MessageLocalization.getComposedMessage("font.1.with.2.is.not.recognized", name, encoding));
        if (cached) {
            synchronized (fontCache) {
                fontFound = (BaseFont)fontCache.get(key);
                if (fontFound != null)
                    return fontFound;
View Full Code Here

                    put(new PdfName("Length" + (k + 1)), new PdfNumber(lengths[k]));
                }
                flateCompress(compressionLevel);
            }
            catch (Exception e) {
                throw new DocumentException(e);
            }
        }
View Full Code Here

                if (subType != null)
                    put(PdfName.SUBTYPE, new PdfName(subType));
                flateCompress(compressionLevel);
            }
            catch (Exception e) {
                throw new DocumentException(e);
            }
        }
View Full Code Here

    protected void createTableDirectory() throws IOException, DocumentException {
        tableDirectory = new HashMap();
        rf.seek(directoryOffset);
        int id = rf.readInt();
        if (id != 0x00010000)
            throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.true.type.file", fileName));
        int num_tables = rf.readUnsignedShort();
        rf.skipBytes(6);
        for (int k = 0; k < num_tables; ++k) {
            String tag = readStandardString(4);
            int tableLocation[] = new int[3];
View Full Code Here

   
    protected void readLoca() throws IOException, DocumentException {
        int tableLocation[];
        tableLocation = (int[])tableDirectory.get("head");
        if (tableLocation == null)
            throw new DocumentException(MessageLocalization.getComposedMessage("table.1.does.not.exist.in.2", "head", fileName));
        rf.seek(tableLocation[TABLE_OFFSET] + HEAD_LOCA_FORMAT_OFFSET);
        locaShortTable = (rf.readUnsignedShort() == 0);
        tableLocation = (int[])tableDirectory.get("loca");
        if (tableLocation == null)
            throw new DocumentException(MessageLocalization.getComposedMessage("table.1.does.not.exist.in.2", "loca", fileName));
        rf.seek(tableLocation[TABLE_OFFSET]);
        if (locaShortTable) {
            int entries = tableLocation[TABLE_LENGTH] / 2;
            locaTable = new int[entries];
            for (int k = 0; k < entries; ++k)
View Full Code Here

   
    protected void flatGlyphs() throws IOException, DocumentException {
        int tableLocation[];
        tableLocation = (int[])tableDirectory.get("glyf");
        if (tableLocation == null)
            throw new DocumentException(MessageLocalization.getComposedMessage("table.1.does.not.exist.in.2", "glyf", fileName));
        Integer glyph0 = new Integer(0);
        if (!glyphsUsed.containsKey(glyph0)) {
            glyphsUsed.put(glyph0, null);
            glyphsInList.add(glyph0);
        }
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(MessageLocalization.getComposedMessage("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

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.