PdfDocument pdf = new PdfDocument();
PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); Document document = new Document(pdf); document.add(createTable(rohit)); document.add(createTable(bruno)); document.close();
InputStream inputStream = this.getAssets().open("PDFToFill.pdf"); long avail = inputStream.available(); byte[] samplePDF = new byte[(int) avail]; inputStream.read(samplePDF , 0, (int) avail); inputStream.close(); PdfDocument objPDF = new PdfDocument(samplePDF); MergeDocument document = new MergeDocument(objPDF); document.getForm().getFields().getFormField("FormField1").setValue("My Text"); document.draw("[PhysicalPath]/FilledPDF.pdf");
public Document CreateDocument(String type){ if (type.isEqual("html")) return new HtmlDocument(); if (type.isEqual("proprietary")) return new MyDocument(); if (type.isEqual("pdf")) return new PdfDocument (); }
PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); PageXofY event = new PageXofY(pdf); pdf.addEventHandler(PdfDocumentEvent.END_PAGE, event); Document document = new Document(pdf); // add all the content event.writeTotal(pdf); document.close();
/** * Constructor * @param document document * @param os outputstream */ public PdfCopy(Document document, OutputStream os) throws DocumentException { super(new PdfDocument(), os); document.addDocListener(pdf); pdf.addWriter(this); indirectMap = new HashMap<PdfReader, HashMap<RefKey, IndirectReferences>>(); parentObjects = new HashMap<PdfObject, PdfObject>(); disableIndirects = new HashSet<PdfObject>(); indirectObjects = new LinkedHashMap<RefKey, PdfIndirectObject>(); savedObjects = new ArrayList<PdfIndirectObject>(); importedPages = new ArrayList<ImportedPage>(); }
/** * Constructor * @param document document * @param os outputstream */ public PdfCopy(Document document, OutputStream os) throws DocumentException { super(new PdfDocument(), os); document.addDocListener(pdf); pdf.addWriter(this); indirectMap = new HashMap<PdfReader, HashMap<RefKey, IndirectReferences>>(); parentObjects = new HashMap<PdfObject, PdfObject>(); disableIndirects = new HashSet<PdfObject>(); indirectObjects = new LinkedHashMap<RefKey, PdfIndirectObject>(); savedObjects = new ArrayList<PdfIndirectObject>(); importedPages = new ArrayList<ImportedPage>(); }
Document document = new Document(new PdfDocument(new PdfWriter(outFileName))); PdfFont bf = PdfFontFactory.createFont(ARABIC_FONT, PdfEncodings.IDENTITY_H); document.setFont(bf); document.add(new Paragraph(ARABIC_TEXT).setTextAlignment(TextAlignment.RIGHT)); document.close();
Wrt(OutputStream os, FdfWriter fdf) throws IOException { super(new PdfDocument(), os); this.fdf = fdf; this.os.write(HEADER_FDF); body = new PdfBody(this); }
PdfDocument doc = new PdfDocument(); doc.load("Input_Docs\\input_doc.pdf"); // Obtain all website addresses in page 2 ArrayList lstSearchResults = (ArrayList) doc.search("http://{1}", // regular expression 2, // page number PdfSearchMode.REGEX, PdfSearchOptions.NONE);
Wrt(OutputStream os, FdfWriter fdf) throws IOException { super(new PdfDocument(), os); this.fdf = fdf; this.os.write(HEADER_FDF); body = new PdfBody(this); }
using BitMiracle.Docotic.Pdf; namespace JavascriptInPdf { public static class Demo { public static void Main(string[] args) { PdfDocument pdf = new PdfDocument(); pdf.OnOpenDocument =pdf.CreateJavaScriptAction("app.alert(\"Hello CodeProject!\", 3);"); pdf.Save("Hello world.pdf"); } } }
PdfDocument doc = new PdfDocument(); // Read the image as BufferedImage object BufferedImage bufImg = ImageIO.read(new File( "SampleImage.PNG")); // Create PdfImage object using the above BufferedImage object PdfImage img = PdfImage.create(bufImg); // Create a PdfPage of image size (image width x image Height) PdfPage page1 = new PdfPage(img.width(), img.height()); // draw the image at 0, 0 page1.drawImage(img, 0, 0); // add the page to the document object doc.add(page1); // save the document to the output file doc.save("PNGImageToPDF.pdf"); doc.close();
public static ExtendedPdfWriter getInstance( Document document, OutputStream os ) throws DocumentException { PdfDocument pdf = new PdfDocument(); document.addDocListener( pdf ); ExtendedPdfWriter writer = new ExtendedPdfWriter( pdf, os ); pdf.addWriter( writer ); return writer; } }
/** * Use this method to get an instance of the <CODE>PdfWriter</CODE>. * @param document The <CODE>Document</CODE> that has to be written * @param os The <CODE>OutputStream</CODE> the writer has to write to. * @param conformanceLevel PDF/A conformance level of a new PDF document * @return a new <CODE>PdfWriter</CODE> * @throws DocumentException on error */ public static PdfAWriter getInstance(final Document document, final OutputStream os, final PdfAConformanceLevel conformanceLevel) throws DocumentException { PdfDocument pdf = new PdfDocument(); document.addDocListener(pdf); PdfAWriter writer = new PdfAWriter(pdf, os, conformanceLevel); pdf.addWriter(writer); return writer; }
/** * Use this method to get an instance of the <CODE>PdfWriter</CODE>. * * @param document The <CODE>Document</CODE> that has to be written * @param os The <CODE>OutputStream</CODE> the writer has to write to. * @return a new <CODE>PdfWriter</CODE> * * @throws DocumentException on error */ public static PdfWriter getInstance(final Document document, final OutputStream os) throws DocumentException { PdfDocument pdf = new PdfDocument(); document.addDocListener(pdf); PdfWriter writer = new PdfWriter(pdf, os); pdf.addWriter(writer); return writer; }
PdfCopyFieldsImp(OutputStream os, char pdfVersion) throws DocumentException { super(new PdfDocument(), os); pdf.addWriter(this); if (pdfVersion != 0) super.setPdfVersion(pdfVersion); nd = new Document(); nd.addDocListener(pdf); }
PdfCopyFieldsImp(OutputStream os, char pdfVersion) throws DocumentException { super(new PdfDocument(), os); pdf.addWriter(this); if (pdfVersion != 0) super.setPdfVersion(pdfVersion); nd = new Document(); nd.addDocListener(pdf); }
public static ExtendedPdfAWriter getInstance( Document document, OutputStream os, IPdfAWriterConfiguration configuration ) throws DocumentException { PdfDocument pdf = new PdfDocument(); document.addDocListener( pdf ); PdfAConformanceLevel conformanceLevel = null; if ( configuration != null ) { conformanceLevel = configuration.getConformanceLevel(); } ExtendedPdfAWriter writer = new ExtendedPdfAWriter( pdf, os, conformanceLevel, configuration ); pdf.addWriter( writer ); return writer; }
/** * Use this method to get an instance of the <CODE>PdfWriter</CODE>. * * @return a new <CODE>PdfWriter</CODE> * @param document The <CODE>Document</CODE> that has to be written * @param os The <CODE>OutputStream</CODE> the writer has to write to. * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument. * @throws DocumentException on error */ public static PdfWriter getInstance(final Document document, final OutputStream os, final DocListener listener) throws DocumentException { PdfDocument pdf = new PdfDocument(); pdf.addDocListener(listener); document.addDocListener(pdf); PdfWriter writer = new PdfWriter(pdf, os); pdf.addWriter(writer); return writer; }