I am trying to open a pdf in Acrobat from a memory stream using the “save” method but I keep getting the following error message: You are in direct-to-file mode,please use Close() instead of Save().
The same code worked fine when we were running our application on .Net 2.0, but now that we have upgraded to 3.5, this is one of the problems I am running into. Let me know if you need to see the code files. There was no problem in the previous version, although.
Hi Susan,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Please share the template file and sample code to show the issue. This will help us identify and resolve the issue soon.
Thank You & Best Regards,
Here are the files.
We were able to solve the problem. Here is the revised code:
Dim iBudg_id As Integer = GetBudgID()
Dim oCover As LFCoverSheet = New LFCoverSheet(iBudg_id)
Dim memStr As MemoryStream = New MemoryStream
Dim data() As Byte = memStr.GetBuffer
Dim sFN As String = “CoverSheet” & iBudg_id & “.pdf”
LFAsposeHTTPSave.SavePDF(memStr.GetBuffer(), Me.Response, sFN)
Public Shared Sub savePDF(ByVal buff As Byte(), ByVal response As HttpResponse, ByVal fn As String)
response.ContentType = “application/pdf”
response.AddHeader(“content-disposition”, “attachment; filename=” & fn)