Skip to main content
Participating Frequently
September 24, 2008
Question

Send Coldfusion variables to (then save) PDF

  • September 24, 2008
  • 5 replies
  • 831 views
My site has a PDF form that is pre-filled with information drawn from a database query. This is accomplished with via FDF, as that was the best way I could figure to do it at the time.

Firefox doesn't allow for the viewing of PDFs within the browser, so when Firefox users click on the link to view the PDF they are prompted to safe the FDF to their hard drive. When they double-click on it, the PDF will open in Safari (on Macs, at least... not sure about PCs).

Using ColdFusion 7, is there a way to write a static PDF using the information from the FDF so people will download that instead? Or, failing that, is there a better method to use from the get-go?

Thanks so much!
    This topic has been closed for replies.

    5 replies

    Participating Frequently
    September 25, 2008
    I actually misspoke in my original post about Firefox not letting you open PDFs; I meant that it would not automatically open the FDF as a PDF. My apologies! Hopefully we'll be able to upgrade to CF8 in the near future but in the meantime I'll check out your suggestions. Thanks for the replies, folks!
    Inspiring
    September 25, 2008
    Cyborgirl wrote:
    > I meant that it would not automatically open the FDF as a PDF.

    Is that the reason you want to generate an actual pdf instead of using fdf?

    On your view page, what content type are you using: application/vnd.fdf?
    MelissaNewlin
    Participant
    October 1, 2008
    quote:

    Originally posted by: -==cfSearching==-
    Cyborgirl wrote:
    > I meant that it would not automatically open the FDF as a PDF.

    Is that the reason you want to generate an actual pdf instead of using fdf?
    On your view page, what content type are you using: application/vnd.fdf?



    The answer is yes to both!
    Inspiring
    September 24, 2008
    Ian Skinner wrote:
    > I think that maybe the issue. If I recall correctly, the free Adobe
    > Reader does not allow full functionality with FDF data.

    That could be it. I have not tried it with FDF data recently.

    > As well as <cfdocument...> you will probably want to check
    > out <cfpdf...>. At least in the latest ColdFusion version I have read
    > that it provides FDF functionality to build a PDF on the fly.

    If it really needs to be a form, I do not think cfdocument handles that. CF8 could probably do it with the <cfpdf ..> tags. For MX7, I think you would need to tap into iText.
    Inspiring
    September 24, 2008
    -==cfSearching==- wrote:
    > Cyborgirl wrote:
    > > Firefox doesn't allow for the viewing of PDFs within the browser
    >

    My Firefox sure does, as long as I have the Adobe plug-in installed of
    course.

    I think that maybe the issue. If I recall correctly, the free Adobe
    Reader does not allow full functionality with FDF data.

    Anyways... As well as <cfdocument...> you will probably want to check
    out <cfpdf...>. At least in the latest ColdFusion version I have read
    that it provides FDF functionality to build a PDF on the fly.
    Inspiring
    September 24, 2008
    Cyborgirl wrote:
    > Firefox doesn't allow for the viewing of PDFs within the browser

    It should with the right configuration settings. At least Firefox 3 does anyway. Is that the reason you want to generate a static pdf instead of using your current method?
    Inspiring
    September 24, 2008
    If it's a form, you could always make it html.

    To make a pdf file, use cfdocument.

    If you want to get fancy, you can use cgi.http_user_agent to determine the browswer and have different versions for different browsers.