After much searching and experimenting, I cannot find a way to programmatically generate an image from a PDF file which contains filled form fields. More specifically, it's not that the libraries I've tried don't generate an image (they do!), but the filled form fields end up blank.
Can anyone point me to a library/solution that works? Ideally in python or javascript, but I'd take just about anything at this point. Ultimately, it needs to end up as an AWS Lambda function.
I'm going to keep trying, but so far PyMuPDF and ImageMagick (ghostscript) don't seem to work, unless there's some options to enable it that I'm missing.
pdf2image (pdftoppm) correctly handles filled form fields. I tested it using this example: https://stackoverflow.com/a/48583124/2009581
Related
I sort of designed my own framework (simple) awhile back to take some HTML templates for reports. That would allow the user to complete the template, and then instead of submitting the data (optional), I pre-processed the template by converting the form elements into spans and div's, etc. Not exactly standard practice, but it worked pretty well for what we were using it for.
I'd like to be able to do something similar with CKEditor. i.e. basically paste the raw HTML for the HTML template into the CKEditor (programmatically from our DB of templates), and then have CKEditor allow the user to fill in the blanks in the template, after which we have to probably process that somehow before submitting the data to the back-end.
I sort of tried that just to see what happens and I get something like what is shown below:
It would probably be easier to just sort of edit the templates by hand and convert them to something that displays well in the CKEditor, but there are a couple of hundred of them. Not sure if CKEditor supports form elements natively, or if there is a plug-in, and then how to convert what we have.
It probably isn't terrible if the form elements are kept in place as opposed to the kind of conversion I did with the custom method, as long as the appearance looks professional and readable.
I'm trying to make a simple form that adds user input to a local xml file. Basically, I need to input a name and a proffesion.
The xml file looks something like this:
<mainNode>
<name>Jeff</name>
<proffesion>Dog Trainer</proffesion>
</mainNode>
But I need some method (either with jQuery or javascript) to populate or add to the existing file (example.xml) using that form instead of creating a new xml file or replacing the nodes. I would show I've tried so far, but i've tried so many examples I can't even decide what to show (but if necessary I'll edit this post ). Any help or pointing in the right direction would be appreciated, thanks ! :)
I'm using the latest jSignature (https://github.com/brinley/jSignature), generating base30 signatures and saving them in a mysql database. This usually works great; on this occasion, though, the user input a signature, it saved, but the signature won't render. Instead, a very non-descript javascript error appears in the dev tools. I have a jsfiddle of it up here:
https://jsfiddle.net/evilpluto/onh3z3k0/
To activate it, I just pull from a hidden form field like so
$(".signature_form").height("170px").jSignature("reset").jSignature("importData", 'data:'+ $(".hiddenSigDataForm").val());
It just seems like the base30 that was generated is corrupt in some way, but I'm not sure why it would generate the javascript error. In the jfiddle I put a working button (loads fine) and then the base30 string that errors as the "non-working" button.
Any ideas?
Uh, oops. The problem was not that jsignature magically couldn't render anymore. The problem was I stored the value in a varchar(255), and the base30 value was truncated to the point that it was unusable. My others worked because they were smaller.
Then I figured out that mysql now allows > 255 in varchars...this has been a very educational night.
I spend a day for digging possible way to manipulate PDF's with forms and still in search. I got PDF, where user can fill some data, save and send to me. The problem is some users didn't know about Acrobat reader and dont't know how to install it. Plus some users are mobile. I try all possible ways - jsPDF lib, FPDF + FPDI, but all this libs work very bad with forms.
Any suggestion how to solve it?
UPDATE. I can't just set php action for PDF form, I also need some action outside PDF.
Finally, I solve this issue. I use php-pdftk class as wrapper for pdftk. This class let me fill form with fillForm(). And I use stamp() and multiStamp() methods of class for add image to filled PDF. I create PDF with image and use them as a stamp.
I am trying to use the FileReader() function to read a file as text and display it back on my webpage - so far, so good. The problem is, instead of allowing the user to select any file off their computer, I want to offer them a specific list of files on the server, via a drop-down menu.
I have no problem populating the drop-down menu with a list of file names. But what I don't know is how to make the file reader take this file name and read the relevant file. I'm guessing the problem is because the file reader expects a file, and is getting a String, but I don't know how to get round this?
I've spent a couple of hours googling and reading tutorials, and they all seem more or less like this one here, which relies on using an <input type="file" . . .> button.
Can anyone tell me how to do this, or point me to some more extensive/varied tutorials?
Thanks in advance.