@Eric iText license is a problem for us if we wish gives our code to Apache.

@Jeremias :I have tried to use PDFDocumentGraphics2D to generate simple PDF
like

--------------------------
AAAA BBBB
--------------------------

with this code :

------------------------------------------------------------------------------------------------------------------------------------------------------------
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.fop.svg.PDFDocumentGraphics2D;
import org.apache.xmlgraphics.java2d.GraphicContext;

public class Test {

    public static void main(String[] args) throws IOException {

        File pdfFile = new File("test.pdf");
        PDFDocumentGraphics2D doc = new PDFDocumentGraphics2D(false);
        doc.setupDefaultFontInfo();
        doc.setGraphicContext(new GraphicContext());

        OutputStream stream = new FileOutputStream(pdfFile);
        doc.setupDocument(stream, 200, 700);
        doc.setDeviceDPI(60);

        doc.drawString("AAAA", 100, 100);
        doc.drawString("BBBB", 160, 100);

        stream.flush();
        doc.finish();
        stream.close();
    }
}
------------------------------------------------------------------------------------------------------------------------------------------------------------

It works but I have the same problem than PDFBox. I must manage x and y
position (increment x and y when I add some text).
I have started to manage that with PDFBox and it works great (increment x
when text is added, increment y when text is too long for the line, etc).

I don't see the advantage to use PDFDocumentGraphics2D instread of using
PDFBox PDPageContentStream.
I'm afraid with FOP because:

* PDFDocumentGraphics2D  is not documented. It seems that nobody (google
tell me that)  has used PDFDocumentGraphics2D to create PDF from scratch.
* PDFDocumentGraphics2D is it an API stable?
* there are a lof of dependencies (batik, etc)

Regards Angelo

2011/10/14 Jeremias Maerki <[email protected]>

> On 14.10.2011 19:09:32 Eric Douglas wrote:
> > Why switch from iText?  What is the issue with the license?  The only
> > thing I can tell is you can't reference iText from your code if you plan
> > to sell your code.  Is there something else I'm missing?  It's highly
> > doubtful they'd sell the code I write, it's all for in house projects.
>
> ASF License Policy: the ASF wants to provide software that people can be
> use in any software, including commercial applications. Recent iText
> versions are published under the AGPL which makes it a complete no-go as
> a dependency on source code hosted at the ASF.
> http://www.apache.org/legal/3party.html
>
> > Does pdfbox do the one thing that iText does that we need to do (if it
> > does we're not seeing it)?  For my purpose we just want a report API
> > that can provide a Graphics object to create a PDF with the exact same
> > code we're using to draw a screen (but Pageable).  Our code for drawing
> > the screen is pageable but of course we can only draw one page at a
> > time.
>
> --> org.apache.fop.svg.PDFDocumentGraphics2D
>
> You can even do multi-page by calling its nextPage() method.
>
>
> Jeremias Maerki
>
>

Reply via email to