1: Protected Sub btnConvert_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles btnConvert.Click
2: Dim pdfConverter As PdfConverter = New PdfConverter
3:
4: pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4
5: pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait
6: pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal
7:
8:
9:
10: pdfConverter.PdfDocumentOptions.ShowHeader = False
11: pdfConverter.PdfDocumentOptions.ShowFooter = False
12:
13: pdfConverter.LicenseKey = "MyLicenseKeyString";
14: Dim downloadBytes() As Byte = pdfConverter.GetPdfBytesFromRtfString(MyRTFString);
15:
16: Dim response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
17:
18: response.Clear()
19: response.AddHeader(
"Content-Type", "binary/octet-stream")
20: response.AddHeader("Content-Disposition", ("attachment; filename=" _
21: + (
"Rendered.pdf" + ("; size=" + downloadBytes.Length.ToString))))
22: response.Flush()
23: response.BinaryWrite(downloadBytes)
24: response.Flush()
25: response.End()
26:
27: End Sub