Package org.apache.pdfbox.pdmodel.common

Examples of org.apache.pdfbox.pdmodel.common.PDStream


        COSStream stream = (COSStream)base;
        String subtype = stream.getNameAsString(COSName.SUBTYPE);

        if (COSName.IMAGE.getName().equals(subtype))
        {
            return new PDImageXObject(new PDStream(stream), resources);
        }
        else if (COSName.FORM.getName().equals(subtype))
        {
            return new PDFormXObject(new PDStream(stream), name);
        }
        else if (COSName.PS.getName().equals(subtype))
        {
            return new PDPostScriptXObject(new PDStream(stream));
        }
        else
        {
            throw new IOException("Invalid XObject Subtype: " + subtype);
        }
View Full Code Here


     * @param document The document in which to create the XObject.
     * @param subtype The subtype of the new XObject.
     */
    protected PDXObject(PDDocument document, COSName subtype)
    {
        stream = new PDStream(document);
        stream.getStream().setName(COSName.TYPE, COSName.XOBJECT.getName());
        stream.getStream().setName(COSName.SUBTYPE, subtype.getName());
    }
View Full Code Here

              clonedVersion.put(base, retval);
          }
          else if( base instanceof COSStream )
          {
              COSStream originalStream = (COSStream)base;
              PDStream stream = new PDStream( destination, originalStream.getFilteredStream(), true );
              clonedVersion.put( base, stream.getStream() );
              for( Map.Entry<COSName, COSBase> entry :  originalStream.entrySet() )
              {
                  stream.getStream().setItem(
                          entry.getKey(),
                          cloneForNewDocument(entry.getValue()));
              }
              retval = stream.getStream();
          }
          else if( base instanceof COSDictionary )
          {
              COSDictionary dic = (COSDictionary)base;
              retval = new COSDictionary();
View Full Code Here

          }
          else if( base instanceof COSStream )
          {
            // does that make sense???
              COSStream originalStream = (COSStream)base;
              PDStream stream = new PDStream( destination, originalStream.getFilteredStream(), true );
              clonedVersion.put( base, stream.getStream() );
              for( Map.Entry<COSName, COSBase> entry : originalStream.entrySet() )
              {
                  stream.getStream().setItem(
                          entry.getKey(),
                          cloneForNewDocument(entry.getValue()));
              }
              retval = stream.getStream();
              target = retval;
          }
          else if( base instanceof COSDictionary )
          {
              COSDictionary dic = (COSDictionary)base;
View Full Code Here

     * @throws IOException if there is an error creating the XObject.
     */
    public static PDImageXObject createThumbnail(COSStream cosStream) throws IOException
    {
        // thumbnails are special, any non-null subtype is treated as being "Image"
        PDStream pdStream = new PDStream(cosStream);
        return new PDImageXObject(pdStream, null);
    }
View Full Code Here

     * @param document the current document
     * @throws java.io.IOException if there is an error creating the XObject.
     */
    public PDImageXObject(PDDocument document) throws IOException
    {
        this(new PDStream(document), null);
    }
View Full Code Here

     */
    public PDImageXObject(PDDocument document, InputStream filteredStream,
            COSBase cosFilter, int width, int height, int bitsPerComponent,
            PDColorSpace initColorSpace) throws IOException
    {
        super(new PDStream(document, filteredStream, true), COSName.IMAGE);
        getCOSStream().setItem(COSName.FILTER, cosFilter);
        resources = null;
        colorSpace = null;
        setBitsPerComponent(bitsPerComponent);
        setWidth(width);
View Full Code Here

        else
        {
            COSStream cosStream = (COSStream)getCOSStream().getDictionaryObject(COSName.MASK);
            if (cosStream != null)
            {
                return new PDImageXObject(new PDStream(cosStream), null); // always DeviceGray
            }
            return null;
        }
    }
View Full Code Here

    public PDImageXObject getSoftMask() throws IOException
    {
        COSStream cosStream = (COSStream)getCOSStream().getDictionaryObject(COSName.SMASK);
        if (cosStream != null)
        {
            return new PDImageXObject(new PDStream(cosStream), null)// always DeviceGray
        }
        return null;
    }
View Full Code Here

                int pageNum = 0;
                for( PDPage page : document.getPages() )
                {
                    pageNum++;
                    System.out.println( "Processing page: " + pageNum );
                    PDStream contents = page.getStream();
                    if( contents != null )
                    {
                        printer.processPage(page);
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.common.PDStream

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.