2

I'm using IIS to send a pdf document (generated by abcpdf 8) in classical asp.

Nothing gets to the browser.

  • FF: The connection was reset - The connection to the server was reset while the page was loading.
  • IE: Internet Explorer cannot display the webpage - Internet Connectivity has been lost
  • Chrome: This web page is not available - Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.

This is the code:

Set theDoc = CreateObject("ABCpdf8.Doc") 
theDoc.FontSize = 96
thedoc.AddText "Hello World"

theData = theDoc.GetData()

Response.ContentType = "application/pdf" '<-- culprit?
Response.AddHeader "content-length", UBound(theData) - LBound(theData) + 1
Response.AddHeader "content-disposition", "inline; filename=MyPDF.PDF"
Response.BinaryWrite theData        

If I comment out the ContentType line, the browser loads the binary data, but of course the data is displayed within the browser and is unreadable in this format.

Jens Frandsen
  • 832
  • 9
  • 13

1 Answers1

2

A colleague from work resolved this one.

Response.BinaryWrite
Response.flush  '<-- this fixes it.

If anyone knows why this works please add a comment.

Jens Frandsen
  • 832
  • 9
  • 13