Package org.axsl.pdf

Examples of org.axsl.pdf.PdfException


        buffer.append("%" + PDFDocument.BINARY_COMMENT  + PDFObject.EOL);
        final byte[] bytes = PDFObject.bufferToByteArray(buffer);
        try {
            this.outputStream.write(bytes);
        } catch (final IOException e) {
            throw new PdfException(e);
        }
        this.position += bytes.length;
    }
View Full Code Here


          by the table's length */

        try {
            this.position += outputXref(this.outputStream);
        } catch (final IOException e) {
            throw new PdfException(e);
        }

        /* construct the trailer */
        final StringBuilder buffer = new StringBuilder();
        buffer.append(getTrailerContent());
        buffer.append("startxref" + PDFObject.EOL);
        buffer.append(xrefPosition + PDFObject.EOL);
        buffer.append("%%EOF" + PDFObject.EOL);

        /* write the trailer */
        byte[] trailer;
        try {
            trailer = buffer.toString().getBytes(PDFDocument.ENCODING);
        } catch (final UnsupportedEncodingException ue) {
            trailer = buffer.toString().getBytes();
        }
        try {
            this.outputStream.write(trailer);
        } catch (final IOException e) {
            throw new PdfException(e);
        }
    }
View Full Code Here

        final PDFDestination existingDestination = destinations.get(
                name);
        if (existingDestination == null) {
            destinations.add(name, destination);
        } else {
            throw new PdfException("Named destination already exists: " + name);
        }
    }
View Full Code Here

     */
    public PDFFontFileStream(final PDFDocument doc, final FontUse font)
            throws PdfException {
        super(doc);
        if (! font.getFont().isEmbeddable()) {
            throw new PdfException("Can't create PDFFontFileStream for a Font "
                    + "that is not embeddable.");
        }
        this.font = font;
    }
View Full Code Here

        }
        final byte[] bytes = PDFObject.stringToByteArray(pdf);
        try {
            stream.write(bytes);
        } catch (final IOException e) {
            throw new PdfException(e);
        }
        return bytes.length;
    }
View Full Code Here

    protected void byteArrayToStream(final byte[] bytes,
            final OutputStream stream) throws PdfException {
        try {
            stream.write(bytes);
        } catch (final IOException e) {
            throw new PdfException(e);
        }
    }
View Full Code Here

                this.out.write(s.getBytes(PDFDocument.ENCODING));
            } catch (final UnsupportedEncodingException ue) {
                this.out.write(s.getBytes());
            }
        } catch (final IOException ex) {
            throw new PdfException(ex);
        }
    }
View Full Code Here

        if (filter == null) {
            return;
        }

        if (this.filtersLocked) {
            throw new PdfException("Cannot add filters to PDFStream after "
                    + "content has been written to the stream.");
        }

        /* Set the new filter to be the output stream. */
        this.out = filter;
View Full Code Here

        if (filterType == null
                || "".equals(filterType)) {
            return null;
        }
        if (this.filtersLocked) {
            throw new PdfException("Cannot add filters to PDFStream after "
                    + "content has been written to the stream.");
        }
        PsFilterType psFilterType = null;
        if (filterType.equals("flate")) {
            psFilterType = PsFilterType.FLATE;
        } else if (filterType.equals("ascii-85")) {
            psFilterType = PsFilterType.ASCII_85;
        } else if (filterType.equals("ascii-hex")) {
            psFilterType = PsFilterType.ASCII_HEX;
        } else {
            throw new PdfException("Unsupported filter type in pdf-filters: " + filterType);
        }
        final PsEncodeFilter encodeFilter = this.getPDFDocument().getPsServer().makeEncodeFilter(psFilterType,
                this.out);
        this.out = encodeFilter;
        this.filters.add(encodeFilter);
View Full Code Here

        }
        this.filtersLocked = true;
        try {
            this.out.write(data);
        } catch (final IOException e) {
            throw new PdfException(e);
        }
        this.bytesWritten += data.length;
    }
View Full Code Here

TOP

Related Classes of org.axsl.pdf.PdfException

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.