Nicola
Nicola

Reputation: 297

Give a name to a pdf printed on screen in Genexus

With a Genexus procedure, setting the call protocol to Http and the output_file rule, you can create a report and show to the user a pdf, basic Genexus tool. My problem is that I can't set the name of this pdf, it ignores the parameter of the output_file rule and if I try to save the pdf manually, it's named as the name of the procedure.

Can I set the name of the pdf somehow? Better if I can send it as parameter

Upvotes: 1

Views: 335

Answers (3)

Guillermo Gandolfo
Guillermo Gandolfo

Reputation: 1

If you add the rule:

Output_file(&FileName, 'PDF');

It does not generate the file with the value of the variable &FileName?

Upvotes: -1

Sergio
Sergio

Reputation: 122

If you don't want to download the PDF directly, create the PDF on the server, then use a &Window object to show it.

&Window.Url = &DownloadPdfUrl
&Window.Open()

Upvotes: -1

ealmeida
ealmeida

Reputation: 512

Add this code to the procedure.

// &DocumentFriendlyName is varchar(100) 
&HttpResponse.AddHeader(!"Content-Type", !"application/pdf")
&HttpResponse.AddHeader(!"Content-Disposition", !"attachment;filename=" + &DocumentFriendlyName + !".pdf")

Upvotes: 1

Related Questions