Search the Community
Showing results for tags 'browserwindow'.
-
Is it not Possible UniSession.BrowserWindow in UniGUIServerModuleHTTPCommand ? - Version 1.90.0.1514 , XE2 In the ServerModule , I made a pdf file from FastReport ( makePdf()) and saved on the /files folder successed . What i want to show the pdf file on the new browser . but failed . What am i wrong ? procedure TUniServerModule.UniGUIServerModuleHTTPCommand( ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); var r : string ; params : TStrings ; cHost : String ; cHostUrlPortPdfRepoPathFilename : String ; begin ARequestInfo.ContentType := 'application/json;charset=utf-8;' ; //success AResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin', '*'); //CORS AResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Credentials', 'true'); //CORS params := ARequestInfo.Params ; // 109-2. FastReport -> pdfFile -> show pdfFile on the New BrowserWindow if UpperCase(ARequestInfo.URI) = UpperCase( '/report' ) then begin Handled := true; r := ''; r := MakePDF() ; // (success getting pdf filename as files/Repo_200217184615048.pdf ) cHostUrlPortPdfRepoPathFilename := ARequestInfo.Host + '/' + r ; cHostUrlPortPdfRepoPathFilename := StringReplace( cHostUrlPortPdfRepoPathFilename , '\' , '/' , [rfReplaceAll, rfIgnoreCase] ) ; // failed below all . Read of address 00000017 ) // (Errors both ) ( Access violation at address 007212DA in module 'fastReport_test.exe' ) UniSession.UrlRedirect( cHostUrlPortPdfRepoPathFilename ); UniSession.BrowserWindow( cHostUrlPortPdfRepoPathFilename , 0, 0, '_blank'); //AResponseInfo.ContentText := cHostUrlPortPdfRepoPathFilename ; end; end; thanks ,