I want the user to have a pdf with an editable field and when the user clicks on the field, it should prompt a drawing tool where he signs or draws anything he wants. When this "image" is done, it should stay inside the borders of this editable field. Is this possible using Itext?
This development will be made in Java.
PDF is not meant to be a replacement for MSPaint.
So this kind of behavior is not going to be available out of the box.
What's important to note here:
the PDF standard itself is working against your use-case
iText only supports the PDF standard
Solutions:
Build a PDF viewer that enables this kind of behavior (there is a company called DocuSign that implemented a similar use-case to allow users to insert their autograph in a PDF document)
Build a plugin for a PDF viewer (e.g. Adobe Reader) that enables this kind of behavior
(warning, dirty hack) insert thousands of tiny interactive components in the PDF document (PDF documents do allow interactive textboxes and checkboxes, etc). Add javascript to your PDF document to register mouse movement, and color the interactive elements based on whether the mouse moved over them or not. I doubt however that this solution would be very performant.
Related
I'm experimenting with the iText5 library to generate an editable (i.e. allow user to enter values in fields like age, name etc) PDF, it looks like the user
can't save the filled in PDF on his work station and the only available functionality is to take a printout of the filled in PDF form.
I tried googling this issue and found that with Adobe Reader, users can't save filled in forms and they need to have Acrobat Pro.
Is there any solution to get this job done (saving the filled in PDF form and emailing it) without needing to get Adobe Pro software?
Please feel free to ask me questions if the problem description is not clear.
Thanks in advance.
There are other viewers that allow people to save filled out forms locally (Nitro? Foxit?). In the early years, there were also people that used iText to create a mini server on the desktop to which the data filled out in Adobe Reader was sent. This server then returned the filled out form. Once Adobe found out about this practice, they changed the EULA of Adobe Reader, saying that you are not allowed to use Adobe Reader for this purpose.
Summarized:
If you want a solution that involves your end users to use Adobe Reader: there is none. You'd violate the EULA of Adobe Reader.
If it's OK to use a PDF viewer other than Adobe Reader: pick another viewer that allows saving of filled out forms.
Note: this is not an iText question.
It looks like I was having older version of Adobe Reader (Version : X), which doesn't have the capability to save user entered data. Upgrading Adobe Reader to DC version seems to have fixed my problem where I can now save the filled in form data. Just trying to document here so that it can be useful for the fellows who may be are running into similar situations.
Can anybody tell me how I could do the following:
I want my Java code to generate a drawing that has multiple connected shapes. Perhaps hundreds of shapes--not huge. I'd like to generate this and save it as a standard file format that somebody could open in a viewer or an editor. I do not want to implement viewing or editing logic--generation only.
I'd like the user to be able to take my generated file, open it in a WYSIWYG editor, and move the shapes around with the lines that connect the shapes staying connected to the shapes as they move. That way, my generation code does not have to be super smart about making sure that connectors don't overlap.
Can anybody suggest a combination of file format, Java library, editor (or some subset of those three) that would work well for this task?
Thoughts so far:
yEd allows this editing behavior and uses graphml as the format. However, I'm not sure how widely used graphml is, and I'm concerned about availability of glyphs.
Inkscape and SVG are widely used, but I'm a complete novice, and so far I haven't been able to get lines to stay connected to other shapes using Inkscape when I move them around.
I'm open to other options...
I want to create a java application that allows users to import a web page and be able to edit it within the program.
Importing a web page will render it and the components of the page (images, text, etc) will be editable or draggable, allowing the user to re-layout the components.
For example, the user can load a web page that has an image header, but decides to have it at the bottom of the page. They can simply click and drag the image down and the html will be reformatted appropriately. It is basically a WYSIWYG html editor...
Will this be a difficult task? I am stuck at how to parse the web page into draggable components and being able to export the html after all the edits.
From what I can see, I'd need wrapper classes for html components and a way to keep track of all the changing positions and objects, but I could be wrong. Are there any helpful tools for this task?
I think creating something from sctratch will be difficult. But you can use Eclipse Web Tools Platform (either just by installing it or by developing your own plugin/distribution based on that). It has a fairly good HTML Editor/Web Page Editor which has WYSIWYG features.
EDIT: Also this question has some tips: Java WYSIWYG HTML editor
I am looking for a (preferably Java-) library or a command line tool to extract word coordinates from pdfs. The input-pdfs contain either text or images with ocr-text in behind.
My Use Case:
In a Java web-application I would like to use this to do hit highlighting and present this without additional software (e.g. Adobe Reader etc.). Instead I want to convert the the matching pages into images and present them within a web page.
You should be able to use http://pdfbox.apache.org/ to do the highlighting and present them as pdf itself. Also look at http://itextpdf.com/.
You can use JPedal to generate the thumbnails (http://www.jpedal.org/pdf_thumbnail_tutorials.php) and extract the text (http://www.jpedal.org/support_egETAW.php)
I have a requirement to create a "mimic" display of a complex electrical system. I have access to real-time status information and system block diagrams in Visio.
Is this a viable approach:
Create an SVG drawing from the system block diagram
Tag the SVG elements of interest with SVG attributes
load the SVG DOM into java
locate the tagged elements and modify them according to system status info (make the element RED if its "in alarm", for example)
render the SVG to PNG for display using BATIK (use a the swing component: JSVGCanvas)
A key requirement is flex ability to modify the SVG after the app is deployed. The app capable of flexibly pulling in different "datapoints" based on the tags in the SVG.
Anyone have success using a similar strategy?
What pitfalls should I expect?
What is out there in the way of SVG editing tools?
I've done something similar for a state of health display. I actually annotated the data objects and had them push their state into a dumb SVG file but the machinery should be roughly the same just reversed.
Benefits:
Makes complex, dynamic diagrams insanely easy to render.
Diagram maintenance is a breeze compared to everything else I've ever used.
Ability to target a web app either directly via SVG or an indirectly via server-rendered images delivered to the client.
Pitfalls:
Data binding can be painful depending on how complex you want your visualization to be. If you want to annotate the SVG to pull data into itself, this will probably end up being the hard part.
You'll need a good grasp of XPath to do anything even slightly tricky. It's never hard but is often tedious to debug XPath expressions.
Editors:
Inkscape. There's a few other vector graphics editors out there that can do SVG, either directly or as an export target, but none of the ones I've seen come close to Inkscape. It doesn't support every feature in the current SVG spec but it sounds like it'll be enough for most if not all of what you want. It's also pretty good about not blasting hand-edits to SVG files for when you need to something it doesn't support.
You should have also a look at SVG Salamander, I have not used it myself but some of the features are:
"An index of all named shapes in the SVG graph is easily accessible. "
"Direct access to the scene graph tree. You can use Java commands to manipulate it directly."