Name in pdf export dialog

  • Thread starter Thread starter glbdev
  • Start date Start date
G

glbdev

I have code in C# to create a pdf file without a Crystal Report Viewer.
Works great except when the user attempts to save the file. In the
"Save a copy ..." dialog box the filename defaults to the aspx page. I
need it to default to a custom report name. How can I specify the new
file name in C# and pass it to the new PDF page?

Thanks,
Gary
 
Hi,

What are you using to generate it but CR ?

In case you are creating a report, exporting it to disk and then serve it
back to the client you will have to modify the headers, I do not remember
right now the correct header that indicate the name of the file being serve,
but a quick search in the archives will get you it.

Btw, when I needed to do this I found the answer in the aspnet NG archive,
so that would be a good stop for you to further info.


--
Ignacio Machin
machin AT laceupsolutions com


|I have code in C# to create a pdf file without a Crystal Report Viewer.
| Works great except when the user attempts to save the file. In the
| "Save a copy ..." dialog box the filename defaults to the aspx page. I
| need it to default to a custom report name. How can I specify the new
| file name in C# and pass it to the new PDF page?
|
| Thanks,
| Gary
|
 
I have code in C# to create a pdf file without a Crystal Report Viewer.
Works great except when the user attempts to save the file. In the
"Save a copy ..." dialog box the filename defaults to the aspx page. I
need it to default to a custom report name. How can I specify the new
file name in C# and pass it to the new PDF page?

Thanks,
Gary

Try the header content-disposition with a value of
attachment;filename=saveasfilename.pdf

so :

Response.AddHeader(
"content-disposition",
"attachment; filename=\"YourFileNameHere.pdf\""
)


HTH :)

Mythran
 
Yes! That worked. Thanks.

- Gary
------------------------------------------------------------------------
 
Back
Top