@@ -16,6 +16,8 @@ public class GXWebProcedure : GXHttpHandler
1616 protected GXReportMetadata reportMetadata ;
1717 protected IReportHandler reportHandler ;
1818 protected IReportHandler oldReportHandler ;
19+ string outputFileName ;
20+ string outputType ;
1921
2022 protected int lineHeight ;
2123 protected int Gx_line ;
@@ -71,12 +73,22 @@ void setContentType()
7173 else
7274 context . HttpContext . Response . ContentType = "text/richtext" ;
7375 }
76+ protected void setOutputFileName ( string fileName )
77+ {
78+ outputFileName = fileName . Trim ( ) ;
79+ }
80+ protected void setOutputType ( string fileType )
81+ {
82+ outputType = fileType . Trim ( ) ;
83+ }
84+
7485 protected override void sendCacheHeaders ( )
7586 {
87+
7688 string utcNow = DateTime . UtcNow . ToString ( "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'" , CultureInfo . GetCultureInfo ( "en-US" ) ) ;
7789 if ( string . IsNullOrEmpty ( context . GetHeader ( HttpHeader . CONTENT_DISPOSITION ) ) )
7890 {
79- context . HttpContext . Response . AddHeader ( HttpHeader . CONTENT_DISPOSITION , "inline; filename=" + GetType ( ) . Name + ".pdf" ) ;
91+ setOuputFileName ( ) ;
8092 }
8193 if ( string . IsNullOrEmpty ( context . GetHeader ( HttpHeader . EXPIRES ) ) )
8294 {
@@ -100,6 +112,23 @@ protected override void sendCacheHeaders()
100112 }
101113 }
102114 }
115+
116+ private void setOuputFileName ( )
117+ {
118+ string fileName = GetType ( ) . Name ;
119+ string fileType = "pdf" ;
120+ if ( ! string . IsNullOrEmpty ( outputFileName ) )
121+ {
122+ fileName = outputFileName ;
123+ }
124+ if ( ! string . IsNullOrEmpty ( outputType ) )
125+ {
126+ fileType = outputType . ToLower ( ) ;
127+ }
128+
129+ context . HttpContext . Response . AddHeader ( HttpHeader . CONTENT_DISPOSITION , $ "inline; filename={ fileName } .{ fileType } ") ;
130+ }
131+
103132 public virtual int getOutputType ( )
104133 {
105134 return GxReportUtils . GetOutputType ( ) ;
@@ -109,6 +138,9 @@ protected bool initPrinter(String output, int gxXPage, int gxYPage, String iniFi
109138 string idiom ;
110139 if ( ! Config . GetValueOf ( "LANGUAGE" , out idiom ) )
111140 idiom = "eng" ;
141+ #if NETCORE
142+ setOuputFileName ( ) ;
143+ #endif
112144 getPrinter ( ) . GxRVSetLanguage ( idiom ) ;
113145 int xPage = gxXPage ;
114146 int yPage = gxYPage ;
0 commit comments