Im trying to check how to generate TIFF using JAVA libraries. I checked JAI, but it requires native libs that I can't use in my project (it must be platform-independent).
I saw a great library, Apache Commons Imaging that generates successfully TIFF, I tried and ...its good.
But I didnt see any way to create TIFF with several pages.
Is there any way to do this?
Thanks!
You can do it with icafe Java library (disclaimer: I am the author of this library). No dependency on any native stuff. Look at the wiki page for item Create multipage TIFF image for example. You can also control the color type and compression method for different pages. Dithering can be set through parameters in case color quantization is required such as saving images to black and white using CCITT group3/group4 compression. The resulting multipage image from the wiki page can be found here.
Related
Is it possible to convert a BufferedImage to scalable vector graphic (SVG) in java? Is there any java library to do so?
I have found Batik useful for converting SVG files to other formats (for example here) but not the other way around.
Also in cases of Potrace and its java implementation delineate i need to install the software, whereas i am looking for a library jar which i can just import and use in my project.
Suggestion for any such library will be highly appreciated.
Batik will allow you to 'embed' a BufferedImage within an SVG file. Here's an example.
Note that a BufferedImage is already a rastered bitmap, however, and will necessarily pixelate as you resize the SVG image. If you're seeking the benefits of image scaling without pixelation, you'll need to go to the extra effort of "redrawing" the image with the Batik API.
Looking for a Java based PDF creation library. We're currently using Apache Velocity with HTML to render PDFs on the fly.
We'd like to be able to find a way to render large images (sometimes as big as 3000 x 1700) in a creative manner within the PDF container. For instance, a scrollable image pane within a PDF. This might not be possible within a PDF, I might be wrong.
Open source would ideal.
For a good PDF library you should take a look at iText: http://itextpdf.com/
I have used images of around 5000x4000 with iText without any problems.
I don't know if it is possible to create a working scrollpane inside a PDF, unless of course you were doing it through a custom PDF creator/viewer.
iText is open source but make sure to check out the AGPL license before you use it commecrially: http://itextpdf.com/terms-of-use/agpl.php
For just creating PDF files from images iText is a little overdimensioned. Give xsPDF a chance, it has no limits for images sizes and seems to be appropriate for your problem.
Just a FYI for anyone that may run into this in the future:
I used a library called PDFBox (http://pdfbox.apache.org/) to open a pre-existing PDF and modify the PDF with a custom sized PDFRectangle with the dimensions of the image. Then inserted the image and rectangle into that new page and got the desired results.
I didn't realize you could have multiple page sizes in a single PDF.
Please point us in right direction
We have a requirement to
Generate a PDF
Edit/Enter some fields on it
Save/Print the information
Should have a button on the pdf "Convert to TIFF" that should generate TIFF image of that PDF
I am sure we can do 1 and 2 very easily, we are planning to use iText API.
We dont have any clue about 4.
Experts if you have any idea please let us know.
We are using Java
There are lots of programs which do PDF to image conversion (both Open Source and Commercial). You can also use icepdf, Jpedal, Qoppa and PDFRenderer
You can create, edit and fill PDF form fields using Gnostice PDFOne. PDFOne can also print PDF documents and forms. Existing documents can also export PDF pages to image formats. For exporting to TIFF, you will also need for Advaned Imaging IO library from Oracle (Sun). Disclaimer: I work for this company.
If you want a button on the PDF to export the document to TIFF, then that is not possible, as PDF specification does not describe such a feature. As mentioned earlier, any PDF document can be converted to image formats including TIFF.
DISCLAIMER: I work for Gnostice.
I want to create pdf, svg and hi-res antialiased img using Java.
The java-gnome project (http://java-gnome.sourceforge.net/4.0/) contains cairo
bindings, but there are problems using it on xp because of the multithreaded gtk
incompatibilities with xp...
Any of you guys that have successfully been using java-gnome cairo stuff compiling on xp?
Are there other java solutions/libraries that can handle the same stuff with the same
quality?
The Apache Batik toolkit is an implementation of SVG built on the Java 2D library: http://xmlgraphics.apache.org/batik/
One can say objectively that it is one of the best, most complete implementations of SVG: http://www.codedread.com/svg-support.php (it's at the bottom of the table)
You can use it to render PDFs (as well as PNGs and other bitmap formats) using the SVG rasterizer component: http://xmlgraphics.apache.org/batik/tools/rasterizer.html
I can also say from personal experience that it has very easy to work with, although I haven't used it very much on Windows.
I am working on a web application (using Grails) which will generate a gift certificate. I'm thinking of a workflow like this:
The user will pick a template which will be stored as an image.
Then the text (name, date, amount etc) will be overlaid on the image to make the final certificate. There is a set of co-ordinates associated with each template which describes where to put each bit of text.
There is a kind of 'live preview' in the browser which shows the user what the final certificate will look like.
When the user is happy with the results, they download the certificate as a PDF and print it.
Can anyone recommend a library for Java (or Groovy) that will make it easy to do this? I'm not particularly worried about speed, as I suspect that the webapp will only be used by a few people at a time.
UPDATE: in the end I used the iText PDF library to overlay text on a PDF template using PDFStamper.
You can do this with the standard Java 2D graphics libraries - create a BufferedImage from the image, get its Graphics and use drawString() to put the text on top. Of course, the text would then be part of the bitmap in the resulting PDF, and not use the full printing resolution.
In addition to the answers above, I have come across the groovy library GraphicsBuilder and the Grails plugin j2D which are also potiential solutions.
You might consider using Batik to do this as SVG. Your image would be an <img> tag and your text would be one or more <text> tags. There's a converter (called FOP, I believe) which will get you PDF output.