Thursday 15 January 2015

Pdf template with iText and Spring MVC -


Text after "itemprop =" text ">

I use this output for spring in MVC and browser (used as shown in PDF forms) by template Want to create a PDF AbstractPdfView but I do not know how to get the document from pdfStamper , or if I should use PdfWriter .. Any thoughts? The code below has been given to me so far, thanks

  public class RecipePdf extends AbstractPdfView {@Override protected Zero BuildPdfDocument (map & lt; string, object & gt; model, document document, pdfWriter PdfWriter, HttpServletRequest request, HttpServletResponse response) Exception {PdfReader pdfTemplate = New PdfReader ("/WEB-INF/template/recipe.pdf") throws; FileOutputStream fileOptputStream = New FileOutputStream ("test.pdf"); PDFStamper Stammer = New PDFFormer (PDF Template, FileOutputStream); Stamper.setFormFlattening (right); Stamper.getAcroFields (). SetField ("number", "12345"); Stamper.close (); PdfTemplate.close (); Text after "itemprop =" text "> 

1) I develop my document generator locally and using JUnit 2 Test them) If you just need a PDF, then this output should be in the DIR ... but ... 3) But ... if you want to include that document in a larger document, Read by using:

  document document = new document (); PdfWriter Author = PdfWriter.getInstance (Document, OutputStream); Document.open (); PdfContentByte CB = Writer. Gate Direct Content (); (String pdfFileName: pdfFileNamesList) {InputStream = new fileInputStream (pdfFileName); PDF Reader Reader = New PDF Reader (In); Int number of pages = ReaderJetNumberoffPage (); For (int i = 1; i & lt; = numberOfPages; i ++) {document.newPage (); // Import Page from source PDF PDF imported page page = author. Tag imported page (reader, I); Add the // page to the destination PDF cb.addTemplate (pages, 0, 0); }}    

No comments:

Post a Comment