Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have the following code, but it doesn't handle filenames with spaces :
<xsl:variable name="fileName"> <xsl:value-of select="$currentPage/@nodeName" /> <xsl:text>.pdf</xsl:text> </xsl:variable> <xsl:value-of select="FergusonMoriyama.Pdf.XsltHelper:AppendResponseHeader('X-Pdf-Force-Download', $fileName)"/>
If the node name is "Open Day" the PDF is named "open.pdf" ... is this a bug with my code or your helper?
Initial glance suggests it is probably to do with whitespace and or / newlines.
I'd suggest passing in a string value to start with e.g:
<xsl:value-ofselect="FergusonMoriyama.Pdf.XsltHelper:AppendResponseHeader('X-Pdf-Force-Download', 'OpenDay.pdf')"/>
And see how that works.
You may end up having to normalize space and or encode your $filename variable accordingly.
HTH
doing this works -
umbraco.library:Replace($currentPage/@nodeName, ' ', 'nbsp')
but it doesn't seem right somehow!? (the nbsp is actually & nbsp ; without the spaces !!)
Try surrounding the filename with quotes:
e.g. "My Report.pdf"
Thanks.
I have the same problem but only in Firefox. I think this is the issue: http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2009/05/06/file-download-problem-filename-with-spaces-truncated-in-ff-and-replaced-by-underscore-in-ie.aspx
Maybe it could be fixed in the Helper method, I'm not sure how to enclose in quotes from XSLT.
-Tom
Wouldn't this work:
<xsl:value-ofselect="FergusonMoriyama.Pdf.XsltHelper:AppendResponseHeader('X-Pdf-Force-Download', '"Open Day.pdf"')"/>
Ah, yes that does the trick for me..thanks.
Cool!
Gordon will have to, it's his thread, I came in late and hijacked it :)
Sorry - just realised that and edited my response as appropriate.
I updated my code to include the quotes around the filename -
<xsl:variable name="fileName"> <xsl:text>"</xsl:text> <xsl:value-of select="$currentPage/@nodeName" /> <xsl:text>.pdf</xsl:text> <xsl:text>"</xsl:text> </xsl:variable> <xsl:value-of select="FergusonMoriyama.Pdf.XsltHelper:AppendResponseHeader('X-Pdf-Force-Download', $fileName)"/>
and it seems to work fine :-)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Naming PDF not working as expected
I have the following code, but it doesn't handle filenames with spaces :
If the node name is "Open Day" the PDF is named "open.pdf" ... is this a bug with my code or your helper?
Initial glance suggests it is probably to do with whitespace and or / newlines.
I'd suggest passing in a string value to start with e.g:
And see how that works.
You may end up having to normalize space and or encode your $filename variable accordingly.
HTH
doing this works -
umbraco.library:Replace($currentPage/@nodeName, ' ', 'nbsp')
but it doesn't seem right somehow!? (the nbsp is actually & nbsp ; without the spaces !!)
Try surrounding the filename with quotes:
e.g. "My Report.pdf"
Thanks.
I have the same problem but only in Firefox. I think this is the issue: http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2009/05/06/file-download-problem-filename-with-spaces-truncated-in-ff-and-replaced-by-underscore-in-ie.aspx
Maybe it could be fixed in the Helper method, I'm not sure how to enclose in quotes from XSLT.
-Tom
Wouldn't this work:
Ah, yes that does the trick for me..thanks.
Cool!
Gordon will have to, it's his thread, I came in late and hijacked it :)
Sorry - just realised that and edited my response as appropriate.
I updated my code to include the quotes around the filename -
and it seems to work fine :-)
is working on a reply...