Blank Form Fields on PDF Created with FPDM on Wordpress - php

I am using FPDM to auto-fill a PDF form fields from a MySQL database via a Wordpress plugin. This works well and the form is generated and filled correctly. However, if I download the generated and filled PDF and send it to other people the form fields are blank to some but not to others.
I am thinking that this is may be a font issue but can't seem to nail down the issue. The template text is Times New Roman. The fields use Times Roman which when I look at Fonts on the PDF Properties pages shows a Custom font (Times Roman) with actual font name TimesNewRomanPSMT. The page also shows TimesNewRoman as an embedded font, like so...
Filled PDF Fonts page
Has anyone else experienced this problem?
Thanks

It's likely the issue is that FPDM does not create something called "appearances" for annotations (fields are a type of annotation), it just populates the value. An appearance allows a PDF viewer that doesn't know about annotations to display their appearance without needing to understand how to use the annotation's properties. Some viewers will generate appearances if they are not present, some won't.
You can test my assertion. If you're seeing blanks by default but see a value when you try to edit the field, then what I describe above is the problem.

Related

TCPDF - How to save PDF to server including form values?

So I'm using TCPDF to generate a PDF with multiple Text Areas in a form. On Submit I want to save this PDF including the newly added Text on my Server but I can't find a way to do it.
I'm using a form like this:
https://tcpdf.org/examples/example_054/
If I change the Output to F I just save the blank PDF to my server.
Any hint what I miss? Have the feeling it's just a simple setting thing.

Autofill Scanned PDF from PHP Form

I have a scanned pdf. The top of the pdf is a signed form and the bottom is a section that people can sign to subscribe to the contract. I have a form that can autopopulate the bottom portion although, since it is a scanned pdf, it has no form fields. Does anyone have a solution where using PHP a person can fill out the form and then autopopulate the bottom of the pdf with the data or create a layer over it with the data and merge it into one pdf. Another option possibly is to automatically add the top portion as an image with the form below it. Thank you in advance for your help.
Here is a link to a sample pdf.
You can use FPDI to write text into a template PDF file. See this example.

How to implement an editable textarea component on a PDF generated by TCPDF library?

I am trying to create an editable HTML textarea component using TCPDF API library. I want to display a scrollable text box on the screen.
Can this be done?
Current TCPDF examples include these: https://tcpdf.org/examples/
I know PDFs can have editable components, but I am not sure how to create them with TCPDF, if it is at all possible.
TD;DR: how can I generate a page with a scrollable textarea using PHP + TCPDF?
Linked Answer using another library (mPDF):
Note that while How to create editable Pdf form in php may work, it does not make use of TCPDF library. My existing codebase relies heavily on TCPDF, I would like to explore the possibility of using TCPDF before I consider adding another library ...
i.e. I rather have an answer of "Not possible" than to use another library at this time.
It looks like the issue is two-fold.
First, you can use a typical form example, like here: https://tcpdf.org/examples/example_054/
However, you cannot see editable fields in a browser, at least you cannot in Mozilla Firefox 56.0.2 as the time of this writing. (https://support.mozilla.org/en-US/questions/1006115)
What you need to do is open the generated PDF in a different viewer that supports editable form fields, such as Adobe PDF reader/other.
Then you can fill out the textarea and if text size exceeds the area of the form element, it will have scroll bars added to the textarea.

FPDF including a php file?

I want to send a dynamic page for printing to labels using Fpdf, however I'm not entirely sure how to get Fpdf to display the contents of my php file.
The php file renders a page with the users url, avatar, custom user background and name in a contactcard.php file.
How would i go about sending this to PDF, using Fpdf?
I have tried creating a function but it will not print images in the PDF.
I've done a similar thing with a real estate property listing. I've output text and images to a pdf for saving or printing using fpdf and php.
I used a form with hidden fields. Click the form button then it goes to the fpdf page. The form uses Post so I can retrieve the data on the fpdf page with something like...
$username = $_POST(username);
The way I've included images is to link to the images directly, well kind of. I have an id retrieved from the database which I include in the file name to display the correct image e.g.
$image = "http://www.yourdomain.com/img/avatar_$id.jpg";
Then you would display them with fpdf like...
$pdf->Cell(10,0,$username,0,0);
$pdf->Image($image,30,36);
You could use sessions so you don't have to include a form. That should work also. Might be more suitable in your case.
I hope this is what you're after.

Working with PDF Forms and PDFTK & PHP

I have a PDF that I am using PDFTK to rip the fields out of. My problem is that the order of the fields and field names are not very clear in the field dump. For example: Checkboxes are given field name "box7", "box3", "box2". I do not know which checkboxes these are without testing.
I need to be able to pro grammatically identify these fields. Or I need to know their location on the pdf.
Ultimately, how can I properly identify these fields either through the user clicking on the field they want or pro grammatically?
Open your pdf in Adobe LiveCycle form designer (included with paid versions of acrobat from version 7 and up). You can see the form field names, rename them as needed etc... LiveCycle blows acrobat forms out of the water! I use PDFTK/PHP/LiveCycle PDFs my work to run our entire product labeling system and created a document self service portal for customers on our website.... feel free to follow up with more questions if you get stuck

Categories