Package org.apache.pdfbox.pdmodel

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


            PDPageContentStream contentStream = new PDPageContentStream(document, page, true, false);
            contentStream.appendRawCommands("/shax sh\n");
            contentStream.appendRawCommands("/" + radialShadingName.getName() + " sh\n");
            contentStream.close();
           
            document.save(file);
            document.close();
           
            // render the PDF and save it into a PNG file
            document = PDDocument.loadNonSeq(new File(file));
            BufferedImage bim = new PDFRenderer(document).renderImageWithDPI(0, 300);
View Full Code Here


                contentStream.drawString(line);
            }
            contentStream.endText();
            contentStream.close();

            doc.save(targetFile.getAbsolutePath());
        }
        finally
        {
            doc.close();
        }
View Full Code Here

            contentStream.drawLine(startX-2, startY+200+fontSize, startX+100+stringWidth+2, startY+200+fontSize);
            contentStream.drawLine(startX+100+stringWidth+2, startY+200+fontSize, startX+100+stringWidth+2, startY-2);
            contentStream.drawLine(startX+100+stringWidth+2, startY-2, startX-2, startY-2);
            contentStream.close();

            doc.save( outfile );
        }
        finally
        {
            if( doc != null )
            {
View Full Code Here

            contentStream.setTextMatrix(transform);
            contentStream.drawString(text);
            contentStream.endText();
            contentStream.close();

            doc.save(targetFile.getAbsolutePath());
        }
        finally
        {
            doc.close();
        }
View Full Code Here

            field = acroForm.getField( "fieldsContainer.nestedSampleField" );
            field.setValue("Text Entry");
        }

        // Save and close the filled out form.
        pdfDocument.save(filledForm);
        pdfDocument.close();
    }

}
View Full Code Here

        contentStream.drawInlineImage(inlineImage2, 350, 500, inlineImage2.getWidth() * 2, inlineImage2.getHeight() * 2);
        contentStream.drawInlineImage(inlineImage2, 350, 600, inlineImage2.getWidth() * 4, inlineImage2.getHeight() * 4);
        contentStream.close();

        File pdfFile = new File(testResultsDir, "inline.pdf");
        document.save(pdfFile);
        document.close();

        document = PDDocument.loadNonSeq(pdfFile, null);
        new PDFRenderer(document).renderImage(0);
        document.close();
View Full Code Here

                    // add the new RubberStamp to the document
                    annotations.add(rubberStamp);
               
                }
                document.save( args[1] );
            }
            finally
            {
                if( document != null )
                {
View Full Code Here

        document.addPage(page);
        contentStream = new PDPageContentStream(document, page, true, false);
        contentStream.drawXObject(ximage4, 0, 0, ximage4.getWidth(), ximage4.getHeight());
        contentStream.close();
      
        document.save(testResultsDir + "/singletiff.pdf");
        document.close();
       
        document = PDDocument.loadNonSeq(new File(testResultsDir, "singletiff.pdf"), null);
        assertEquals(2, document.getNumberOfPages());
       
View Full Code Here

            ++pdfPageNum;
        }
       
        assertEquals(countTiffImages, pdfPageNum);

        document.save(testResultsDir + "/multitiff.pdf");
        document.close();
       
        document = PDDocument.loadNonSeq(new File(testResultsDir, "multitiff.pdf"), null);
        assertEquals(countTiffImages, document.getNumberOfPages());
       
View Full Code Here

                XmpSerializer serializer = new XmpSerializer();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                serializer.serialize(metadata, baos, false);
                metadataStream.importXMPMetadata( baos.toByteArray() );

                document.save( args[1] );
            }
            finally
            {
                if( document != 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.