Free Support Forum - aspose.com

How to write .net code in to classic ASP?

Hi,

I have to write this .net code in classic ASP.Can someone please translate this in to classic ASP. I dont know whether Aspose.PDF supports these methods in ASP.

Pdf pdf = new Pdf();

pdf.BindFO(@"C:\SummaryAllXml.xml", @"C:\bar_summaryAll_pdf.xsl");

byte[] myDataBuffer = pdf.GetBuffer(); //webClient.DownloadData(strURL);

MemoryStream ms = new MemoryStream();

pdf.Save(ms);

return ms.GetBuffer();

Waiting for your response.

Thanks,

Sankalp Singhal

Hi,

Please look at http://www.aspose.com/wiki/default.aspx/Aspose.Pdf/UsingInCOMApplications.html for detailed information.

Thanks.

Hi,

I have gone through this article, but i have one question here. As shown in the code above, i am using Save method which saves into a memory stream i. pdf.Save(ms).

Can you tell me if i use the same code in Asp/Vbscript, which method i should use, moreover in which variable i would store the stream, as VBScript doesnt support any inbuilt memory stream class.

Hi,

I am sorry but I am not sure of it as well, I will discuss this with the developer and let you know about it. Sorry for inconvenience.

Thanks.

The following code saves the PDF into stream and then send the stream to web browser. I hope this can help you.

'Create a document
Dim pdf1
Set pdf1 = CreateObject(“Aspose.Pdf.Pdf”)

Dim lic
Set lic = CreateObject(“Aspose.Pdf.License”)
lic.SetLicense (“D:\CSharp\Test\License\Aspose.Custom.lic”)

pdf1.BindXML_2 “d:/Test/test.xml”, Nothing

'Create a .NET memory stream to save the document to.
Dim stream
Set stream = CreateObject(“System.IO.MemoryStream”)

pdf1.Save_3(stream)

Response.Clear

'Specify the document type.
Response.ContentType = “application/pdf”
'Other options:
'Response.ContentType = “text/plain”
'Response.ContentType = “text/html”

'Specify how the document is sent to the browser.
Response.AddHeader “content-disposition”,“attachment; filename=MyDocument.pdf”
'Another option could be:
'Response.AddHeader “content-disposition”,“inline; filename=MyDocument.doc”;

'Get data bytes from the stream and send it to the response.
Dim bytes
bytes = stream.ToArray()
Response.BinaryWrite(bytes)
Response.Flush
Response.End