Import a value to a PDF

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Monje
User
Posts: 7

Import a value to a PDF

Post by Monje »

Hi, first of all, I want to say I'm a bit noob with php so any help is really welcome.

I'm having some problems trying to add a certain field value to an existing PDF.

I have a database with just 4 values (ID, name, docname, description). The PDF is a designed medical sheet (i'm bringing it as a Custom File for now, if there is a better way, please let me know).
This PDF only has a single text field for writing/editing in one of its pages.

The thing is that I'm having problems trying to add a certain value to that text field. The value i need to bring is the ID number, everytime someone wants to print the PDF, and this number is what joins the pdf printed with the row in database.

Does anyone know the right way/code to do this?

Thanks in advance for the help.


arbei
User
Posts: 9358

Post by arbei »

What do you means by "add a certain field value to an existing PDF"?

PHPMaker do not support updating PDF, it only supports export table to PDF.

Give us more details about your question.


Monje
User
Posts: 7

Post by Monje »

Hi, thanks for replying, what i need is the next..

I have a PDF with an already complete and existing format, which contains 4 medical sheets (4 pages), this PDF (on it's first page) has a small single text box where you can freely write.

What i'm trying to do is that this single editable text box, be filled with a value from the database. As i said, i have a single table with 4 fields (ID, name, docname, description), and i need that the text box from PDF
be filled with the numeric value from the ID (which is AI).

First of all, before i was using the PDF as a customfile, now, i changed that, and i'm calling the pdf as a reference.

In the ListOption_Load i created an extra option and in ListOption_Rendered i bring that option as a link which refs to the folder with the PDF.
So, when you see the list, next to each row, you can also see a Link which opens the PDF.

Now... Is there a way to bring/copy/export/etc the respective ID number of the Row to the editable text box from the PDF? The idea is that, every link from each row, when it opens the PDF, bring the ID value from its Row,
so, on the list page, when you click on the first row, brings ID 1 to the text box PDF, when you click on the second row brings ID 2 to the text box PDF, and so on.

I don't know if i clearly stated what i need. If there are needed more details, please, let me know. Thanks in advance for the help.


arbei
User
Posts: 9358

Post by arbei »

You can add the value of ID as the URL parameter in your link, then read the URL parameter and fill the PDF form by writing JavaScript in the PDF.

For example:
(Create the link as below)
http://localhost/pdf/abc.pdf?ID=1&Name= ... rsion=2017

You can use $this-><Field>->CurrentValue; to get the value of ID field in the ListOptions_Rendered Server Event.

To write the JavaScript code in your PDF file, Search "passing parameter to pdf form" in Google search and read the related topic for more information.


Post Reply