Skip to main content
November 10, 2010
Answered

cffunction - Accepting and Returning PDFs in memory

  • November 10, 2010
  • 1 reply
  • 999 views

Hello,

This is something that I should probably know by now in my CF career, but up until now I have never thought/had to do this type of thing.

I have defined a couple functions that I would like to handle accepting, manipulating, and returning PDFs in memory. What data types should I be using for accepting and returning the PDF in memory between functions?  I would prefer to stay away from "any" if possible, but let me know if that is the only choice.

...

<cffunction name="AddMeUhWaddaMak" returntype="any" access="public" output="no">
        <cfargument name="src" type="any" required="yes">
        <cfargument name="name" type="string" required="no">

         ...
               <cfpdf action="addWatermark"
                        source="#arguments.src#"
                        name="#arguments.name#"
                         ...>
                     <cfreturn arguments.name>

</cffunction>

...

    This topic has been closed for replies.
    Correct answer cfjedimaster

    I do not believe there is a formal type def for PDF variables. So I'd

    stick with any.

    You can add validation if you want by using: isPDFObject

    1 reply

    cfjedimaster
    cfjedimasterCorrect answer
    Inspiring
    November 10, 2010

    I do not believe there is a formal type def for PDF variables. So I'd

    stick with any.

    You can add validation if you want by using: isPDFObject

    Inspiring
    November 10, 2010

    I've never tried, but "binary" sounds like it ought to cover this sort of scenario?

    --

    Adam

    cfjedimaster
    Inspiring
    November 10, 2010

    Ah - binary is a good idea. But I'd still follow that up with the

    isPDFObject to be extra sure.