Thanks, Dan!

I'll update the README and clean the code soon.

Few notes about the docx impl:

- caching and cloning of the WordprocessingMLPackage (the template)
Initially you load the template and later make a copy of it for which
interpolation.
I've simplified this in the pdf version by caching the byte[] for the
template and creating a new document (PDDocument) for each interpolation
The same simplification could be applied to the docx version.
Let me know if you like it and I'll prepare a PR.

- save as HTML action
I've decided to remove this from the PDF version for two reasons
1. I wasn't able to convince PDFBox to properly export the interpolated
PDDocument with org.apache.pdfbox.util.PDFText2HTML. I guess there is some
limitation when the PDDocument contains a form (PDAcroForm)
2. It would be much simpler to create (and design!) the HTML file with
template engine like Velocity, StringTemplate, ...


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Dec 1, 2014 at 9:01 AM, Dan Haywood <[email protected]>
wrote:

> Nice stuff, Martin... thanks for doing this.
>
> It'd be nice if you could update the README so that we can get an idea of
> what the "user experience" is in terms of defining a PDF template.  I've
> built several of these mail merge modules for Isis and Naked Objects over
> the years, and the .docx implementation that I did had the least friction
> in terms of ongoing maintenance.  To use isis-module-pdf, it'd be helpful
> to see what sort of tools the developer would use in order to build the
> template.
>
> Cheers
> Dan
>
>
> On 30 November 2014 at 19:18, Martin Grigorov <[email protected]>
> wrote:
>
> > Hi,
> >
> > I've cloned isis-module-docx and reworked some parts of it to generate
> PDF
> > with Apache PDFBox: https://github.com/martin-g/isis-module-pdf
> > The ugly part is that you have to predefine all input placeholders for
> > collection items, e.g. the order lines in the demo. I wasn't able to
> find a
> > way to dynamically generate the table. That's why the table in the .docx
> > that I export as a template PDF has 6 predefined rows ... :-/
> >
> > The module is not finished. If there is interest I will clean it up and
> > contribute to Isis Addons.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Wed, Nov 26, 2014 at 5:43 PM, Jeroen van der Wal <[email protected]
> >
> > wrote:
> >
> > > Sorry, the library being used is docx4j [1]
> > >
> > > [1] http://www.docx4java.org/trac/docx4j
> > >
> > > On Wed, Nov 26, 2014 at 5:39 PM, Jeroen van der Wal <
> [email protected]
> > >
> > > wrote:
> > >
> > > > Hi there,
> > > >
> > > > A good entry point would be isis-module-docx from Isisaddons which
> is a
> > > > wrapper around Apache POI.
> > > >
> > > > Cheers,
> > > >
> > > > Jeroen
> > > >
> > > >
> > > > [1] https://github.com/isisaddons/isis-module-docx
> > > >
> > > >
> > > >
> > > > On Wed, Nov 26, 2014 at 4:22 PM, Martin Grigorov <
> [email protected]
> > >
> > > > wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> I am not aware of an addon that gives you this functionality out of
> > the
> > > >> box.
> > > >> But you may want to implement it yourself:
> > > >> - add an action method that receives the entity/object as a
> parameter
> > > >> - use any Java library that is capable to produce pdf/doc files out
> of
> > > the
> > > >> entity (e.g. http://poi.apache.org, https://pdfbox.apache.org,
> > > >> https://code.google.com/p/flying-saucer/)
> > > >> - I am not sure about this step: you need to stream the document
> back
> > to
> > > >> the browser. Maybe returning Blob would do it automatically ?!
> > > >>
> > > >> Martin Grigorov
> > > >> Wicket Training and Consulting
> > > >> https://twitter.com/mtgrigorov
> > > >>
> > > >> On Wed, Nov 26, 2014 at 5:07 PM, Resto Tesis <[email protected]
> >
> > > >> wrote:
> > > >>
> > > >> > Hello everyone !!
> > > >> >
> > > >> > We ask them if you can use ISIS to print a .doc or .pdf file. What
> > we
> > > >> need
> > > >> > is to perform some service that allows us to print data, such as
> > > >> billing or
> > > >> > ticket for customers of a restaurant.
> > > >> >
> > > >> > Greetings and thanks, hope to answer !!
> > > >> >
> > > >> > Resto-Thesis
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
>

Reply via email to