It's possible to include button appearances (or references to them) in an FDF. What will the source of the logo be? I'm trying to figure out if it can be a static image that can be retrieved from the server or if it will need to be generated dynamically, perhaps from a database, at the time of the request? Are you using some sort of API to generate the FDF?
I'm using PHP to generate the FDF file and to present the visitor with the correct PDF/FDF combination.
The source of the logo will/can be an image (.jpg) file (from same server as the PDF is on). Was hoping to be able to use an URL pointing to the image to be used.
I came across this document:
How to load dynamic images in a PDF file using Adobe Reader/Acrobat 8+
Some down in that document we can read:
- Solution 2: Upload the images as attachments.
- Do one of the following to upload the images as attachments:
- Use the attachment panel in Acrobat (View > Navigation Panels > Attachments > Add).
- Update the value of the image field using script at runtime to point to the attachment.
But it looks like it is doable.
Which image file to load depends on which person is requesting the PDF and corresponding FDF file.
Can someone here please explain to me how I do accomplish what is described above?
The technique discussed in that link is for an XFA form created in LiveCycle Designer that uses an image field, so it can't work with an Acroform.
If you are able to convert the logos to PDF and make each page that is to be the source of a logo a template, you can simply include what is in essence a URL to the PDF on the server and include the name of the template you want to use. This is the simplest approach but it does mean the logos have to be prepared beforehand. If you were using the FDF Toolkit, you'd use the FDFSetAPRef method. If you'd like an example FDF that demonstrates this, I'd be happy to post one later.
Hi George and thanks for your reply
The end result of the PDF should be a one page PDF (one A4 page that is).
If I can merge the LOGO-PDF with the other PDF into one PDF and still be able to use the corresponding FDF to fill out the PDF form fields then I'll be more than happy.
Basically I need LOGO-PDF to be on top, then the other PDF below.
I also need this to work using the standard Acrobat reader (the free version).
Are you saying I can set the URL to the LOGO-PDF in the FDF? If that is the case... wohaaa.
If you could show me an example on how this is done it would be great.
I'll be able to send a sample FDF in a few hours. You will have to set up a button on the form where you want the logo to be paced and set its layout to something other than label only. You'll then need to prepare the PDF that contains the logo and make the page a template, giving it a name like "logo". I'd suggest using a separate PDF for each logo, as opposed to placing all of the logos in the same PDF, and set the template name of each the same. This will simplify the code that creates the FDF. Stay tuned...
Here's a sample FDF:
1 0 obj <</FDF << /Fields 2 0 R >> >>
2 0 obj [
<</T(button1) /APRef << /N <</F(http://www.example.com/logo1.pdf) /Name(logo) >> >> >>
<</T(text1) /V (Hello) >>
<</Root 1 0 R>>
In this example, the button that displays the logo is named "button1" and the PDF that contains the logo is given by that URL. The template name is "logo". I included a text field as well, which you're already familiar with.
Thanks for that..
But what is the relationship between the template file and the name "logo".
If I understand you correct then http://www.example.com/logo1.pdf is the PDF with the logo.
Where is the templatefile supposed to be stored, and will it in your example have to be named logo.pdf
I thought there were two PDFs involved here:
- logo1.pdf with only the logo.
- template file with all the text fields
Why no URL to the template PDF? Or is "logo" supposed to be changed with URL to template PDF?
Will the button1 automatically be replaced with the logo1.pdf ?
Will this work just using the two PDFs and the FDF, and Acrobat (the free version), or do I need any aditional software on the server to make this work?
Could you please explain...
A template is not a different file, think of it as the name of a page in the "logo.1.pdf" file. So you specify a page name as opposed to a page number. In Acrobat 9 you make a page a template and give it a name by selecting: Advanced > Document Processing > Page Templates
and add a new one. In Acrobat 11 it's: Tools > Document Processing > Page Templates
As I recommended earlier, for each logo, use a separate PDF but name the template for each the same.
When the FDF is loaded, Acrobat/Reader will then fetch the page named "logo" from the PDF and use it as the appearance for the button. So you need three things: the PDF form, the FDF that the server generates, and a PDF containing the logo on the web server.