Package org.pdfbox.pdmodel

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


      ByteArrayInputStream in = new ByteArrayInputStream(bs.toByteArray());

      PDMetadata metadataStream = new PDMetadata(document, in, false);
      catalog.setMetadata(metadataStream);

      document.save(tempFile.getAbsolutePath());

    } finally {
      if (document != null)
        document.close();
    }
View Full Code Here


    PDDocument pdf = null;
    try {
      pdf = new PDDocument();
      pdf.addPage(new PDPage()); // Need page to open in Acrobat
      pdf.save(pdfFile.getAbsolutePath());
    } finally {
      if (pdf != null)
        pdf.close();
    }
View Full Code Here

      PDMetadata metadataStream = new PDMetadata(document, is, false);
      catalog.setMetadata(metadataStream);

      // Save
      try {
        document.save(file.getAbsolutePath());
      } catch (COSVisitorException e) {
        throw new TransformerException("Could not write XMP-metadata: "
            + e.getLocalizedMessage());
      }
View Full Code Here

                    {
                        throw new IOException( "Unknown argument:" + args[i] );
                    }
                }
                doc = app.createPDFFromText( new FileReader( args[args.length-1] ) );
                doc.save( args[args.length-2] );
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
View Full Code Here

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

            {
                SetField example = new SetField();

                pdf = PDDocument.load( args[0] );
                example.setField( pdf, args[1], args[2] );
                pdf.save( args[0] );
            }
        }
        finally
        {
            if( pdf != null )
View Full Code Here

                    COSStream cosStream = (COSStream)base;
                    cosStream.getUnfilteredStream();
                    cosStream.setFilters(null);
                }
            }
            doc.save( out );
        }
        finally
        {
            if( doc != null )
            {
View Full Code Here

                ImportFDF importer = new ImportFDF();
                pdf = PDDocument.load( args[0] );
                fdf = FDFDocument.loadXFDF( args[1] );

                importer.importFDF( pdf, fdf );
                pdf.save( args[2] );
                fdf.save( "tmp/outputXFDFtoPDF.fdf");
            }
        }
        finally
        {
View Full Code Here

                document.getDocumentCatalog().setOpenAction( javascript );
                if( document.isEncrypted() )
                {
                    throw new IOException( "Encrypted documents are not supported for this example" );
                }
                document.save( args[1] );
            }
            finally
            {
                if( document != null )
                {
View Full Code Here

            PDPageContentStream contentStream = new PDPageContentStream(doc, page);
           
            contentStream.drawImage( ximage, 20, 20 );
         
            contentStream.close();
            doc.save( file );
        }
        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.