Package org.pdfbox.pdmodel

Examples of org.pdfbox.pdmodel.PDDocument.save()


            PDDocumentNameDictionary names = new PDDocumentNameDictionary( doc.getDocumentCatalog() );
            names.setEmbeddedFiles( efTree );
            doc.getDocumentCatalog().setNames( names );
           
           
            doc.save( file );
        }
        finally
        {
            if( doc != null )
            {
View Full Code Here


            contentStream.setFont(font, 12);
            contentStream.moveTextPositionByAmount(100, 700);
            contentStream.drawString(message);
            contentStream.endText();
            contentStream.close();
            doc.save(file);
            System.out.println(file + " created!");
        }
        finally
        {
            if (doc != null)
View Full Code Here

            document = new PDDocument();
            //Every document requires at least one page, so we will add one
            //blank page.
            PDPage blankPage = new PDPage();
            document.addPage( blankPage );
            document.save( file );
        }
        finally
        {
            if( document != null )
            {
View Full Code Here

                {
                    throw new IOException( "Error: A PDF document must have at least one page, " +
                                           "cannot remove the last page!");
                }
                document.removePage( 0 );
                document.save( args[1] );
            }
            finally
            {
                if( document != null )
                {
View Full Code Here

            //then draw a red box in the lower left hand corner
            contentStream.setNonStrokingColor( Color.RED );
            contentStream.fillRect( 10, 10, 100, 100 );
           
            contentStream.close();
            doc.save( file );
        }
        finally
        {
            if( doc != null )
            {
View Full Code Here

                    pagesOutline.appendChild( bookmark );
                }
                pagesOutline.openNode();
                outline.openNode();
               
                document.save( args[1] );
            }
            finally
            {
                if( document != null )
                {
View Full Code Here

                OutputStream out = updatedStream.createOutputStream();
                ContentStreamWriter tokenWriter = new ContentStreamWriter(out);
                tokenWriter.writeTokens( tokens );
                page.setContents( updatedStream );
            }
            doc.save( outputFile );
        }
        finally
        {
            if( doc != null )
            {
View Full Code Here

                        StandardProtectionPolicy spp =
                            new StandardProtectionPolicy(ownerPassword, userPassword, ap);                       
                        spp.setEncryptionKeyLength(keyLength);
                        document.protect(spp);
                    }
                    document.save( outfile );
                }
                else
                {
                    System.err.println( "Error: Document is already encrypted." );
                }
View Full Code Here

                pdf = PDDocument.load( args[0] );
                fdf = FDFDocument.load( args[1] );
                importer.importFDF( pdf, fdf );
               
                pdf.save( args[2] );
            }
        }
        finally
        {
            close( fdf );
View Full Code Here

                    }
                }
            }
            ConvertColorspace converter = new ConvertColorspace();
            converter.replaceColors(doc, colorEquivalents, destColorspace );
            doc.save( outputFile );
        }
        finally
        {
            if( doc != null )
            {
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.