Skip navigation
Tore B. Krudtaa
Currently Being Moderated

Dynamic Logo in PDF - Is it possible?

Feb 19, 2013 3:06 AM

Tags: #pdf #dynamic #logo #fdf

Hi

 

I have earlier generated text field values in a PDF using a FDF file.

The FDF file is generated using PHP on the server side.

 

Now I need to do the same but I also need to be able to set a LOGO (image file) in the PDF dynamically (programatically).

Is there a way to accomplish this using Acrobat XI PRO to make a PDF with the form fields needed?

 

Perhaps using a hidden textfield value as the basis for the logo image. Then perhaps set the hidden textfield value same way the visible text fields get their value from the FDF file?

 

It is important that this is working without the PDF viewer (person) not having to do anything to make the logo appear.

 

It would be great if possible to do this using an FDF file. If not possible then I would like to hear if I can combine FDF with some other solutions.

 

Any suggestions on how to make this work?

 
Replies
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Feb 19, 2013 7:25 AM   in reply to Tore B. Krudtaa

    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?

     
    |
    Mark as:
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Feb 19, 2013 7:49 AM   in reply to Tore B. Krudtaa

    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.

     
    |
    Mark as:
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Feb 19, 2013 8:19 AM   in reply to Tore B. Krudtaa

    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...

     
    |
    Mark as:
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Feb 19, 2013 12:13 PM   in reply to Tore B. Krudtaa

    Here's a sample FDF:

     

    %FDF-1.2

    1 0 obj <</FDF << /Fields 2 0 R >> >>

    endobj

    2 0 obj [

    <</T(button1) /APRef << /N <</F(http://www.example.com/logo1.pdf) /Name(logo) >> >> >>

    <</T(text1) /V (Hello) >>

    ]

    endobj

    trailer

    <</Root 1 0 R>>

    %%EOF

     

     

    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.

     
    |
    Mark as:
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Feb 19, 2013 3:23 PM   in reply to Tore B. Krudtaa

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points