FIX6.00.04 · Released 16 July 2026
High Importance
FIXfinPOWER Connect
Released in
6.00.04
16 July 2026
  1. Opened22 May
  2. Closed22 May
  3. Released16 Jul
Article 22581 Job J036948

Scripting; Web Service (Web API); request.CreatePdfResponse and request.CreatePdfResponseFromHtml do not set the correct content type when attempting to deliver a PDF file

The way custom Web Services send their response changed in version 6 when moving from the .NET Framework to .NET 9.

In doing so, the incorrect HTTP content-type header was being returned.

The following Script demonstrates two methods of returning a PDF file which have now been fixed:

Public Function Main(request As finwsHttpRequest) As finwsHttpResponse

  ' PDF File
  Dim FileName As String = finBL.Runtime.FileUtilities.GetTemporaryFileName("test", "pdf")
  Dim FileData As Byte()
  finBL.PdfUtilities.CreatePdfFileFromHtml("<h1>PDF IN A FILE</h1>", FileName)
  finBL.Runtime.FileUtilities.ReadBinaryFile(FileName, FileData)
  Return request.CreatePdfResponse(HttpStatusCode.OK, FileData)
    
  ' HTML to PDF
  'Return request.CreatePdfResponseFromHtml(HttpStatusCode.OK,"<b>this is HTML</b>")

End Function