I hate to tell you this but you basically cheated by creating a physical file. :-) I was trying to avoid physical files for reasons (needing to give the files unique names, having to run a scheduled task to remove old PDF's, etc.) Perhaps the physical file is the only option....ah, well.

-- Angeli

On 7/25/2017 11:53 AM, Ajas Mohammed wrote:
Hi there,

Love head scratchers, some times though  😉

I believe what you are seeing is browser interpreting things rather than an issue with Coldfusion.

I tested in Internet Explorer and the save as was cfm filename.pdf.

In Firefox it was document.pdf.

In Chrome, it is cfm filename.cfm.

So I tricked Chrome. I used JavaScript to open resulting pdf in a new tab. Once Chrome sees the right extension.pdf instead of.cfm, the download / save as button results in receipt.pdf.

Now I believe you are creating pdf in variable so you can come up with your variations as needed. I created physical PDF file, but the logic should help you provide direction.

I will attach my sample code shortly.

Thanks,

Ajas Mohammed

On Tue, Jul 25, 2017 at 10:58 AM Angeli Wahlstedt <[email protected] <mailto:[email protected]>> wrote:

    Hmm, I wonder if this may be an "undocumented feature" in CF 10
    and 11...? Also, could IIS be a factor as well?


    -- Angeli


    On 7/24/2017 10:50 PM, Mike G wrote:
    I get the pdf file name, but I am on CF 9

    On Mon, Jul 24, 2017 at 9:05 PM, Angeli Wahlstedt
    <[email protected] <mailto:[email protected]>> wrote:

        Actually, I had tried that (along with using "SaveAsName" in
        the cfdocument tag), but it still came up as "receipt.cfm"
        for me.  What name came up for you when you clicked the
        "Download" icon in Google Chrome's PDF viewer?

        -- Angeli


        On 7/24/2017 8:14 PM, Mike G wrote:
        <cfheader name="Content-Disposition" value="inline;
        filename=survey.pdf">
        <cfcontent type="application/pdf" reset="true"
        variable="#content#">

        This works for me, try attachments inline..

        On Mon, Jul 24, 2017 at 4:31 PM, Angeli Wahlstedt
        <[email protected] <mailto:[email protected]>> wrote:

            Long time, no talk. Here's a head-scratcher that I want
            to bounce off you folks. A client just told me that a
            CFM page which generates a PDF document for displaying
            in the browser doesn't work quite right in Google
            Chrome. It displays the PDF content correctly, but when
            you select to download the document, it defaults as the
            name "receipt.cfm" rather than, say, "receipt.pdf" which
            confuses customers. (If you rename it as "receipt.pdf",
            it saves correct, but still...)  Here's the complete code:

            <cfinclude template="inc_generateReceipt.cfm" />
            <cfheader name=“Content-Disposition”
            value=“attachment;filename=receipt.pdf” />
            <cfcontent type="application/pdf" reset="true"
            variable="#variables.PDFContent#" />

            (The included template obviously generates the PDF
            document using CFDocument.) No matter what I try, the
            browser still says "receipt.cfm" for the PDF document.
            Firefox also has a similar issue -- it says
            "document.pdf" instead of "receipt.pdf". I've Googled to
            no avail.

            The production server is running CF 10, and I've
            replicated the same issue on CF 11. Any thoughts?

            Thanks,
            Angeli Wahlstedt
            IdeaSculpt LLC

-- -- You received this message because you are subscribed to
            the "Houston ColdFusion Users' Group" discussion list.
            To unsubscribe, send email to
            [email protected]
            <mailto:[email protected]>
            For more options, visit
            http://groups.google.com/group/houcfug?hl=en

            --- You received this message because you are subscribed
            to the Google Groups "Houston ColdFusion Users' Group"
            group.
            To unsubscribe from this group and stop receiving emails
            from it, send an email to
            [email protected]
            <mailto:houcfug%[email protected]>.
            For more options, visit https://groups.google.com/d/optout.


-- -- You received this message because you are subscribed to the
        "Houston ColdFusion Users' Group" discussion list.
        To unsubscribe, send email to
        [email protected]
        <mailto:[email protected]>
        For more options, visit
        http://groups.google.com/group/houcfug?hl=en

        ---
        You received this message because you are subscribed to the
        Google Groups "Houston ColdFusion Users' Group" group.
        To unsubscribe from this group and stop receiving emails
        from it, send an email to
        [email protected]
        <mailto:[email protected]>.
        For more options, visit https://groups.google.com/d/optout.

-- -- You received this message because you are subscribed to the
        "Houston ColdFusion Users' Group" discussion list.
        To unsubscribe, send email to
        [email protected]
        <mailto:[email protected]>
        For more options, visit
        http://groups.google.com/group/houcfug?hl=en

        ---
        You received this message because you are subscribed to the
        Google Groups "Houston ColdFusion Users' Group" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to [email protected]
        <mailto:[email protected]>.
        For more options, visit https://groups.google.com/d/optout.


-- -- You received this message because you are subscribed to the
    "Houston ColdFusion Users' Group" discussion list.
    To unsubscribe, send email to
    [email protected]
    <mailto:[email protected]>
    For more options, visit http://groups.google.com/group/houcfug?hl=en

    ---
    You received this message because you are subscribed to the
    Google Groups "Houston ColdFusion Users' Group" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    For more options, visit https://groups.google.com/d/optout.

-- -- You received this message because you are subscribed to the
    "Houston ColdFusion Users' Group" discussion list.
    To unsubscribe, send email to [email protected]
    <mailto:[email protected]>
    For more options, visit http://groups.google.com/group/houcfug?hl=en

    ---
    You received this message because you are subscribed to the Google
    Groups "Houston ColdFusion Users' Group" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    For more options, visit https://groups.google.com/d/optout.

--
<Ajas Mohammed />
iUseDropbox(http://db.tt/63Lvone9)
http://ajashadi.blogspot.com
We cannot become what we need to be, remaining what we are.
No matter what, find a way. Because thats what winners do.
You can't improve what you don't measure.
Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.
--
--
You received this message because you are subscribed to the "Houston ColdFusion Users' Group" discussion list.
To unsubscribe, send email to [email protected]
For more options, visit http://groups.google.com/group/houcfug?hl=en

---
You received this message because you are subscribed to the Google Groups "Houston ColdFusion Users' Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to [email protected]
For more options, visit http://groups.google.com/group/houcfug?hl=en

--- You received this message because you are subscribed to the Google Groups "Houston ColdFusion Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to