Package org.apache.pdfbox.pdmodel.common

Examples of org.apache.pdfbox.pdmodel.common.PDStream.createOutputStream()


            PDStream src = page.getContents();
            if(src != null)
            {
                PDStream dest = new PDStream( document.createCOSStream());
                importedPage.setContents( dest );
                os = dest.createOutputStream();

                byte[] buf = new byte[10240];
                int amountRead = 0;
                is = src.createInputStream();
                while((amountRead = is.read(buf,0,10240)) > -1)
View Full Code Here


            PDStream src = page.getContents();
            if(src != null)
            {
                PDStream dest = new PDStream( document.createCOSStream());
                importedPage.setContents( dest );
                os = dest.createOutputStream();

                byte[] buf = new byte[10240];
                int amountRead = 0;
                is = src.createInputStream();
                while((amountRead = is.read(buf,0,10240)) > -1)
View Full Code Here

                }
            } // For each page token

            // We replace original page content by the edited one.
            PDStream updatedPageContents = new PDStream(inputFile);
            ContentStreamWriter contentWriter = new ContentStreamWriter( updatedPageContents.createOutputStream() );
            contentWriter.writeTokens( editedPageTokens );
            currentPage.setContents( updatedPageContents );

        } // For each document page
    }
View Full Code Here

            PDStream src = page.getContents();
            if(src != null)
            {
                PDStream dest = new PDStream( document.createCOSStream());
                importedPage.setContents( dest );
                os = dest.createOutputStream();

                byte[] buf = new byte[10240];
                int amountRead = 0;
                is = src.createInputStream();
                while((amountRead = is.read(buf,0,10240)) > -1)
View Full Code Here

            if (resetContext)
            {
                // create a new stream to encapsulate the existing stream
                PDStream saveGraphics = new PDStream(document);
                output = saveGraphics.createOutputStream();
                // save the initial/unmodified graphics context
                saveGraphicsState();
                close();
                if (compress)
                {
View Full Code Here

            if (resetContext)
            {
                // create a new stream to encapsulate the existing stream
                PDStream saveGraphics = new PDStream( document );
                output = saveGraphics.createOutputStream();
                // save the initial/unmodified graphics context
                saveGraphicsState();
                close();
                if( compress )
                {
View Full Code Here

            PDStream src = page.getContents();
            if(src != null)
            {
                PDStream dest = new PDStream( new COSStream( src.getStream(), document.getScratchFile() ) );
                importedPage.setContents( dest );
                os = dest.createOutputStream();

                byte[] buf = new byte[10240];
                int amountRead = 0;
                is = src.createInputStream();
                while((amountRead = is.read(buf,0,10240)) > -1)
View Full Code Here

                    myrect.setLowerLeftX(250);
                    myrect.setLowerLeftY(550);

                    // Create a PDXObjectForm
                    PDStream formstream = new PDStream(document);
                    OutputStream os = formstream.createOutputStream();
                    PDXObjectForm form = new PDXObjectForm(formstream);
                    form.setResources(new PDResources());
                    form.setBBox(myrect);
                    form.setFormType(1);
                    // adjust the image to the target rectangle and add it to the stream
View Full Code Here

                }
            } // For each page token

            // We replace original page content by the edited one.
            PDStream updatedPageContents = new PDStream(inputFile);
            ContentStreamWriter contentWriter = new ContentStreamWriter( updatedPageContents.createOutputStream() );
            contentWriter.writeTokens( editedPageTokens );
            currentPage.setContents( updatedPageContents );

        } // For each document page
    }
View Full Code Here

                        }
                        newTokens.add( token );

                    }
                    PDStream newContents = new PDStream( document );
                    ContentStreamWriter writer = new ContentStreamWriter( newContents.createOutputStream() );
                    writer.writeTokens( newTokens );
                    newContents.addCompression();
                    page.setContents( newContents );
                }
                document.save( args[1] );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.