Daniel Wamara <daolwin <at> hotmail.com> writes:
>public static String test(String templateSource, String pdfView,
ITextRaupeDealer raupeDealer) throws IOException, DocumentException,
ParseException {
>        String outputPDFTemp = tempFolder + File.pathSeparator + pdfView + "_"
+ raupeDealer.getCustomer().getId() + ".pdf";
>        PdfReader reader = new PdfReader(templateSource);
>        ByteArrayOutputStream baos = new ByteArrayOutputStream();
>        PdfStamper stamper = new PdfStamper(reader, baos);
>        AcroFields form = stamper.getAcroFields();
>        Date date = new Date();
>       
>        Set<String> keys = form.getFields().keySet();
>       
>        for (String string : keys) {
>            System.out.println("Key found: " + string);
>        }
>               
>        form.setField("date", FORMATTER.format(date));
>        form.setField("companyAddress", "Test");
>        stamper.setFormFlattening(true);
>        stamper.close();
>        return outputPDFTemp;
>    }

You're returning outputPDFTemp, but never writing a file there.  All you do is
fill in a BAOS that is never written anywhere.  It goes out of scope when you
leave the function, and all your work is lost to the ether.  

Perhaps you meant to use a FileOutputStream?

With the other code you supplied, it sounds like you're reusing your input.  

Same File Size + No Visible Changes = Same File

--Mark Storer
  Senior Software Engineer
  Autonomy Cardiff

#include <a new joke for my sig>


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to