I am building a Module that will use iTextSharp to dynamically create PDF Reports. While attempting the "Hello World" script, I keep getting the following error:
"
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled."
The "Hello World" Script is as follows:
Dim
ms
As
New
MemoryStream
Dim
document
As
New
iTextSharp.text.Document
Dim
writer
As
iTextSharp.text.pdf.PdfWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(document, ms)
document.Open()
document.Add(
New
Paragraph(
"Hello ByteBlocks!"
))
document.AddHeader(
"bbHeader"
,
"iText For .Net"
)
document.Close()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType =
"application/pdf"
Response.BinaryWrite(ms.GetBuffer)
Response.
End
()
After a lot of looking, I think what I need to do is somehow create a new "Blank" page in memory and then display it to the browser window. Does anyone have any ideas?
I have also tested this code, and it gets the same error.
Protected
Sub
cmdPrinterTest_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
cmdPrinterTest.Click
Response.Write(UserId.ToString())
End
Sub
Thanks in advance.