Java library for PDF reader supporting highlighting - java

I would like to build my own pdf-reader in Java and would like to have the possibility to highlight words in the pdf and save these highlights.
I have seen there exist several PDF libraries I can use, but I wonder which would be best to use for this purpose.
Is it possible to do this kind of highlighting, and is there a specific library or so to help me do this?
Any help is greatly appreciated!

Here you have a big list of Open Source pdf libraries for java. I haven't used any of them but I'll bet for pdfBox that's part of Apache Foundation. It has a specific class to highlight PDFs in xml but I think you also have to rebuid them.

Use Apache Lucene Library. It provide highlight option for search terms.

You can use Apache PDFBox for highlighting in PDF.
Link: https://pdfbox.apache.org/

Related

Rendering and Printing RTF in Java

I've been trying to locate a decent RTF editing and printing solution in java that we can plug into our application.
Looked at the RTFEditorKit however it seems to fail at rendering more complicated (and less conforming) RTF documents.
Also worked a bit with iText but it seems to not support printing. (not to mention support for RTF has been removed in later versions)
Really trying to stick with RTF as that's what our client base is used to, but i'm open to ideas.
Does anybody else do this? How do you do it?
Thanks for any help and suggestions.
Suggestion:
See how good OpenOffice (or its successor, LibreOffice) works with your particular mix of .rtf files. If OpenOffice/LibreOffice works, then just use it's (Java-ready) API.
Try to use the kit to open your RTF
http://java-sl.com/advanced_rtf_editor_kit.html
And this component to print
http://java-sl.com/JEditorPanePrinter.html

Which free Java library can I use to generate PDFs in Java?

I have a need to generate some PDF documents through Java .. Which API or library, etc, can I use to do this in the most effective way ?
EDIT: Added requirements:
I'll be using this for a commercial application, so I'd like to work with a library which is free to use for commercial applications as well ..
Secondly, my work will be like this: I have a pre-defined PDF file which has blank text fields in it. This would be my 'template file', and can be generated manually. Then, within my program, I would then take this file, put data into the text fields and generate new PDFs. And this would be done repeatedly.
So for the above added requirements, what would be the best library for me now ? iText does seem appealing, but it seems I would have to pay for it if I wanted to use it in a commercial app, which I'd like to avoid ..
http://itextpdf.com/download.php
Check out iText:
http://itextpdf.com/
I am using Apache PDFBox to generate PDF in java
Reference : https://pdfbox.apache.org/
iText is probably the best, but if you cannot live with their license there is also Apache PDFBox.
If you are creating your PDF templates yourself, then you might want to look at Docmosis - it lets you create templates in Word or OpenOffice with fields that you replace when you render documents. There is a free version you can distribute with your application if your document volumes are low.

Creating PDF for Java applications

How to create pdf with complex design views in Java?I have tried it using jasper reports.Is there Any Ideas for creating PDF for Income tax forms?.
A commonly used Java API to create PDF files is iText. Give it a look. API documentation can be found here, code examples can be found here, a tutorial can be found here.
A good but less widely known Java API is OOo API wherein you can create any OOo document to your taste and finally export to PDF.
Have you taken a look at the Apache PDFBox project. I believe you can create PDFs using this library, although it is more commonly used in Lucene to convert PDFs to text to allow indexing.
You could also try Docmosis or JODConverter to do the conversion as long as you can install OpenOffice somewhere. They work on many platforms and can be Java controlled and will save you the hassle of learning the OOo UNO API.
Design your complex PDF Form with the appropriate tools, something like Acrobat Professional. Then from your Java code, you generate an FDF file (Form Data Format) and let the PDF Reader do the merging or you do it from the server-side and stream back the result.
Possible solutions to process FDF are Adobe Java FDF Toolkit or Apache PDFBox.
one approach that requires very little programming is converting your Java object to XML using the Java Binding API for XML (JABX) and then use apache FOP (XSL-FO) to create the PDF from XML. The adavantage of this approach is that is almost 100% declarative, .i.e no programming involved other than executing jabx and apache fop. If you want a tool to create the XSL-FO template, look at J4L FO Designer
You can try ITextPDF.jar Add this jar to your application and please go through the examples to know more about the tags and design procedure used for creating a PDF Document. Check this link for a simple exmaple http://itextpdf.com/examples/iia.php?id=12

Generating PDF files dynamically in servlets?

Is there any way to create PDF dynamically against receiving texts and images?
You can use the iText library.
If you're generating reports then JasperReports can generate PDF output.
iText and JasperReports are great to create pdf reports via Java.
With iReport you can easily create the jasper files needed for this. Very easy to use tool and helped me a lot when I needed to create some pdf reports.
We use Flying Saucer.
There are several libraries for working with PDF in Java, for example iText and Apache PDFBox.
There's a ton of ways to generate PDFs on the fly.
In Java, you can use the iText library. If you wanted to use Jython, you could use reStructuredText and possibly rst2pdf. Or you could just generate LaTeX files on the fly and make a system call to LaTeX.
A bit late but maybe useful to other searchers. Docmosis can populate templates and produce documents on the fly. Assuming you mean you need to include images and text, Docmosis can populate these on the fly from Java objects, text/image files, database queries etc. Java and Openoffice are required server-side.
I work with Apache FOP and it works amazingly well. It's well supported and it's based on the XSL-FO standard.
If you're doing reports based on for example SQL queries then iReport is a good choice although it's sometimes a bit heavyweight. On the other hand if you're going to produce something that's more about presentation and design, like a product sheet or a brochure then my experience is that it's alot easier to first generate html and css and then use it to generate a PDF.

Is there a way to modify a Microsoft Word footer using Apache POI?

I need to modify the content of a Word footer using a Java API.
The Apache POI project does not seem to support this functionality:
WARNING - you shouldn't change the headers or footers, as offsets are not yet updated!
My question is twofold:
Does anyone know of a way to do this using POI's API?
Is there a different java API which does offer this functionality?
Can't speak for POI but Aspose.Words will let you manipulate Doc files. It ain't cheap though.

Categories