Io.memorystreams

I have this .aspx page that has a load of information processed upon it and returns to me a bunch of tables and graphs displaying all the info i need. I then created an io.memorystream so i could store all the information from the labels,etc to be passed through to a pdf that i have already created in it's own class. I know the pdf work's because i created it in another program first before copying it over the problem that i am havin is tryin to read the information out of the memorystream and into the various table rows and columns that i have created. It would be a great help if you could help me out.

cheers..

Hi,

Thank you for considering Aspose.

I don't know if I have understood your requirement exactly. You created a PDF as template and them you want to put the content from a Aspx page into the PDF template, right? If so, Aspose.Pdf can't match your requirement and I don't think there is a PDF component can match your requirement. But you can define a XML as template, and dynamically adding the content through API using Aspose.Pdf.

Please elaborate you requirement if I have not understood it exactly.

ok too make things easier I have copied here the aspx page and the class to see if you can understand things better.

ASPX PAGE

Private Sub Pdf()


Dim myReport As New pdf_1
Dim herdID As String = Session("ID")

Dim mystream As IO.MemoryStream = myReport.Main(ID, Session("Name"), Session("Address"),_
Session("Season"), Session("Period"), Label1.Text, Label2.Text, Label3.Text, label4.Text, _
label5.Text, label6.Text, label7.Text, label8.Text, label9.Text, label10.Text, label11.Text, _
label12.Text, label13.Text, label14.Text, label15.Text, label16.Text, label17.Text, label18.Text, _
label19.Text, label20.Text, label21.Text, label22.Text, label23.Text, label24.Text, label25.Text, _
label26.Text, label27.text, label28.text, label29.text, label30.text, label31.Text, label32.Text, _
label33.Text, label34.Text, label35.Text, label36.Text, label37.Text, label38.Text, label39.Text, _
label40.Text, label41.Text, label42.Text, label43.Text, label44.Text, label45.Text, label46.Text, _
label47.Text, label48.Text, label49.Text)

Dim byteArray() As Byte = mystream.ToArray()

mystream.Flush()
mystream.Close()

Response.Clear()
Response.AddHeader("content-disposition", "attachment; filename=Report.pdf")
Response.AddHeader("Content-Length", byteArray.Length.ToString())
Response.ContentType = "application/pdf"
Response.BinaryWrite(byteArray)
Response.End()

End Sub

CLASS

Imports System
Imports System.IO
Imports System.Data
Imports Aspose.Pdf

Public Class annual_1

Public Function Main(ByVal ID As String, ByVal Name As String, ByVal Address As String, ByVal Season As String, ByVal Period As String, ByVal info1 As String, ByVal info2 As String, ByVal info3 As String, ByVal t4r1c2 As String, ByVal t4r1c3 As String, ByVal t4r1c4 As String, ByVal t4r2c2 As String, ByVal t4r3c2 As String, ByVal t4r4c2 As String, ByVal t4r4c3 As String, ByVal t4r4c4 As String, ByVal t4r5c2 As String, ByVal t4r5c3 As String, ByVal t4r5c4 As String, ByVal t8r1c2 As String, ByVal t8r2c2 As String, ByVal t8r3c2 As String, ByVal t8r4c2 As String, ByVal t11r1c2 As String, ByVal t11r2c2 As String, ByVal t11r3c2 As String, ByVal t11r4c2 As String, ByVal t14r1c2 As String, ByVal t14r2c2 As String, ByVal t14r3c2 As String, ByVal t14r4c2 As String, ByVal t18r2c2 As String, ByVal t18r2c3 As String, ByVal t18r2c4 As String, ByVal t18r3c2 As String, ByVal t18r3c3 As String, ByVal t18r3c4 As String, ByVal t18r4c2 As String, ByVal t18r4c3 As String, ByVal t18r4c4 As String, ByVal t18r5c2 As String,
ByVal t18r5c3 As String, ByVal t18r5c4 As String, ByVal t22r1c2 As String, ByVal t22r2c2 As String, ByVal t22r3c2 As String, ByVal t22r4c2 As String, ByVal t22r5c2 As String, ByVal t22r6c2 As String, ByVal t25r1c2 As String, ByVal t25r2c2 As String, ByVal t25r3c2 As String, ByVal t25r4c2 As String, ByVal t25r5c2 As String)

Dim m As New IO.MemoryStream

Dim Pdf As Pdf = New Pdf
Pdf.SetLicense("\bin\aspose.pdf.lic")

Dim image1 As Image = New Image
image1.ImageInfo.File = "charts\chart1.jpeg"
image1.ImageInfo.ImageFileType = ImageFileType.Jpeg

Dim image2 As Image = New Image
image2.ImageInfo.File = "charts\chart2.jpeg"
image2.ImageInfo.ImageFileType = ImageFileType.Jpeg

Dim image3 As Image = New Image
image3.ImageInfo.File = "charts\chart3.jpeg"
image3.ImageInfo.ImageFileType = ImageFileType.Jpeg


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Create Tables to Show the Data '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim table1 As Table = New Table
table1.ColumnWidths = "500"
table1.DefaultCellTextInfo.FontSize = 12
table1.DefaultCellTextInfo.LineSpacing = 3
table1.DefaultCellPadding.Bottom = 5
table1.DefaultCellPadding.Left = 5
table1.DefaultCellPadding.Right = 5
table1.DefaultCellPadding.Top = 5

Dim table2 As Table = New Table
table2.ColumnWidths = "250 250"
table2.DefaultCellTextInfo.FontSize = 12
table2.DefaultCellTextInfo.LineSpacing = 3
table2.DefaultCellPadding.Bottom = 5
table2.DefaultCellPadding.Left = 5
table2.DefaultCellPadding.Right = 5
table2.DefaultCellPadding.Top = 5

Dim table3 As Table = New Table
table3.ColumnWidths = "500"
table3.DefaultCellTextInfo.FontSize = 12
table3.DefaultCellTextInfo.LineSpacing = 3
table3.DefaultCellPadding.Bottom = 5
table3.DefaultCellPadding.Left = 5
table3.DefaultCellPadding.Right = 5
table3.DefaultCellPadding.Top = 5

Dim table4 As Table = New Table
table4.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table4.ColumnWidths = "200 100 100 100"
table4.DefaultCellTextInfo.FontSize = 12
table4.DefaultCellTextInfo.LineSpacing = 3
table4.DefaultCellPadding.Bottom = 5
table4.DefaultCellPadding.Left = 5
table4.DefaultCellPadding.Right = 5
table4.DefaultCellPadding.Top = 5

Dim table5 As Table = New Table
table5.ColumnWidths = "500"
table5.DefaultCellTextInfo.FontSize = 12
table5.DefaultCellTextInfo.LineSpacing = 3
table5.DefaultCellPadding.Bottom = 5
table5.DefaultCellPadding.Left = 5
table5.DefaultCellPadding.Right = 5
table5.DefaultCellPadding.Top = 5

Dim table6 As Table = New Table
table6.ColumnWidths = "300"
table6.DefaultCellTextInfo.FontSize = 12
table6.DefaultCellTextInfo.LineSpacing = 3
table6.DefaultCellPadding.Bottom = 5
table6.DefaultCellPadding.Left = 5
table6.DefaultCellPadding.Right = 5
table6.DefaultCellPadding.Top = 5

Dim table7 As Table = New Table
table7.IsFirstParagraph = True
table7.ColumnWidths = "500"
table7.DefaultCellTextInfo.FontSize = 12
table7.DefaultCellTextInfo.LineSpacing = 3
table7.DefaultCellPadding.Bottom = 5
table7.DefaultCellPadding.Left = 5
table7.DefaultCellPadding.Right = 5
table7.DefaultCellPadding.Top = 5

Dim table8 As Table = New Table
table8.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table8.ColumnWidths = "400 100"
table8.DefaultCellTextInfo.FontSize = 12
table8.DefaultCellTextInfo.LineSpacing = 3
table8.DefaultCellPadding.Bottom = 5
table8.DefaultCellPadding.Left = 5
table8.DefaultCellPadding.Right = 5
table8.DefaultCellPadding.Top = 5

Dim table9 As Table = New Table
table9.ColumnWidths = "500"
table9.DefaultCellTextInfo.FontSize = 12
table9.DefaultCellTextInfo.LineSpacing = 3
table9.DefaultCellPadding.Bottom = 5
table9.DefaultCellPadding.Left = 5
table9.DefaultCellPadding.Right = 5
table9.DefaultCellPadding.Top = 5

Dim table10 As Table = New Table
table10.ColumnWidths = "500"
table10.DefaultCellTextInfo.FontSize = 12
table10.DefaultCellTextInfo.LineSpacing = 3
table10.DefaultCellPadding.Bottom = 5
table10.DefaultCellPadding.Left = 5
table10.DefaultCellPadding.Right = 5
table10.DefaultCellPadding.Top = 5

Dim table11 As Table = New Table
table11.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table11.ColumnWidths = "400 100"
table11.DefaultCellTextInfo.FontSize = 12
table11.DefaultCellTextInfo.LineSpacing = 3
table11.DefaultCellPadding.Bottom = 5
table11.DefaultCellPadding.Left = 5
table11.DefaultCellPadding.Right = 5
table11.DefaultCellPadding.Top = 5

Dim table12 As Table = New Table
table12.ColumnWidths = "500"
table12.DefaultCellTextInfo.FontSize = 12
table12.DefaultCellTextInfo.LineSpacing = 3
table12.DefaultCellPadding.Bottom = 5
table12.DefaultCellPadding.Left = 5
table12.DefaultCellPadding.Right = 5
table12.DefaultCellPadding.Top = 5

Dim table13 As Table = New Table
table13.ColumnWidths = "500"
table13.DefaultCellTextInfo.FontSize = 12
table13.DefaultCellTextInfo.LineSpacing = 3
table13.DefaultCellPadding.Bottom = 5
table13.DefaultCellPadding.Left = 5
table13.DefaultCellPadding.Right = 5
table13.DefaultCellPadding.Top = 5

Dim table14 As Table = New Table
table14.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table14.ColumnWidths = "400 100"
table14.DefaultCellTextInfo.FontSize = 12
table14.DefaultCellTextInfo.LineSpacing = 3
table14.DefaultCellPadding.Bottom = 5
table14.DefaultCellPadding.Left = 5
table14.DefaultCellPadding.Right = 5
table14.DefaultCellPadding.Top = 5

Dim table15 As Table = New Table
table15.ColumnWidths = "500"
table15.DefaultCellTextInfo.FontSize = 12
table15.DefaultCellTextInfo.LineSpacing = 3
table15.DefaultCellPadding.Bottom = 5
table15.DefaultCellPadding.Left = 5
table15.DefaultCellPadding.Right = 5
table15.DefaultCellPadding.Top = 5

Dim table16 As Table = New Table
table16.IsFirstParagraph = True
table16.ColumnWidths = "300"
table16.DefaultCellTextInfo.FontSize = 12
table16.DefaultCellTextInfo.LineSpacing = 3
table16.DefaultCellPadding.Bottom = 5
table16.DefaultCellPadding.Left = 5
table16.DefaultCellPadding.Right = 5
table16.DefaultCellPadding.Top = 5

Dim table17 As Table = New Table
table17.ColumnWidths = "400"
table17.DefaultCellTextInfo.FontSize = 12
table17.DefaultCellTextInfo.LineSpacing = 3
table17.DefaultCellPadding.Bottom = 5
table17.DefaultCellPadding.Left = 5
table17.DefaultCellPadding.Right = 5
table17.DefaultCellPadding.Top = 5

Dim table18 As Table = New Table
table18.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table18.ColumnWidths = "200 100 100 100"
table18.DefaultCellTextInfo.FontSize = 12
table18.DefaultCellTextInfo.LineSpacing = 3
table18.DefaultCellPadding.Bottom = 5
table18.DefaultCellPadding.Left = 5
table18.DefaultCellPadding.Right = 5
table18.DefaultCellPadding.Top = 5

Dim table19 As Table = New Table
table19.ColumnWidths = "500"
table19.DefaultCellTextInfo.FontSize = 12
table19.DefaultCellTextInfo.LineSpacing = 3
table19.DefaultCellPadding.Bottom = 5
table19.DefaultCellPadding.Left = 5
table19.DefaultCellPadding.Right = 5
table19.DefaultCellPadding.Top = 5

Dim table20 As Table = New Table
table20.ColumnWidths = "300"
table20.DefaultCellTextInfo.FontSize = 12
table20.DefaultCellTextInfo.LineSpacing = 3
table20.DefaultCellPadding.Bottom = 5
table20.DefaultCellPadding.Left = 5
table20.DefaultCellPadding.Right = 5
table20.DefaultCellPadding.Top = 5

Dim table21 As Table = New Table
table21.IsFirstParagraph = True
table21.ColumnWidths = "300"
table21.DefaultCellTextInfo.FontSize = 12
table21.DefaultCellTextInfo.LineSpacing = 3
table21.DefaultCellPadding.Bottom = 5
table21.DefaultCellPadding.Left = 5
table21.DefaultCellPadding.Right = 5
table21.DefaultCellPadding.Top = 5

Dim table22 As Table = New Table
table22.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table22.ColumnWidths = "400 100"
table22.DefaultCellTextInfo.FontSize = 12
table22.DefaultCellTextInfo.LineSpacing = 3
table22.DefaultCellPadding.Bottom = 5
table22.DefaultCellPadding.Left = 5
table22.DefaultCellPadding.Right = 5
table22.DefaultCellPadding.Top = 5

Dim table23 As Table = New Table
table23.ColumnWidths = "500"
table23.DefaultCellTextInfo.FontSize = 12
table23.DefaultCellTextInfo.LineSpacing = 3
table23.DefaultCellPadding.Bottom = 5
table23.DefaultCellPadding.Left = 5
table23.DefaultCellPadding.Right = 5
table23.DefaultCellPadding.Top = 5

Dim table24 As Table = New Table
table24.ColumnWidths = "500"
table24.DefaultCellTextInfo.FontSize = 12
table24.DefaultCellTextInfo.LineSpacing = 3
table24.DefaultCellPadding.Bottom = 5
table24.DefaultCellPadding.Left = 5
table24.DefaultCellPadding.Right = 5
table24.DefaultCellPadding.Top = 5

Dim table25 As Table = New Table
table25.DefaultCellBorder = New BorderInfo(CType(BorderSide.All, Integer), 0.5)
table25.ColumnWidths = "400 100"
table25.DefaultCellTextInfo.FontSize = 12
table25.DefaultCellTextInfo.LineSpacing = 3
table25.DefaultCellPadding.Bottom = 5
table25.DefaultCellPadding.Left = 5
table25.DefaultCellPadding.Right = 5
table25.DefaultCellPadding.Top = 5

Dim table26 As Table = New Table
table26.ColumnWidths = "500"
table26.DefaultCellTextInfo.FontSize = 12
table26.DefaultCellTextInfo.LineSpacing = 3
table26.DefaultCellPadding.Bottom = 5
table26.DefaultCellPadding.Left = 5
table26.DefaultCellPadding.Right = 5
table26.DefaultCellPadding.Top = 5

Dim titlefont As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo
titlefont.Color = New Aspose.Pdf.Color(47, 79, 79)
titlefont.FontName = "Helvetica-BoldOblique"
titlefont.Alignment = AlignmentType.Center
titlefont.IsUnderline = True
titlefont.FontSize = 16
titlefont.LineSpacing = 1.5

Dim text1 As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo
text1.Color = New Aspose.Pdf.Color(0, 0, 0)
text1.FontName = "Helvetica-Bold"
text1.IsUnderline = True
text1.FontSize = 12

Dim text2 As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo
text2.Color = New Aspose.Pdf.Color(0, 0, 0)
text2.FontName = "Helvetica-Bold"
text2.FontSize = 12

Dim text3 As Aspose.Pdf.TextInfo = New Aspose.pdf.TextInfo
text3.Color = New Aspose.Pdf.Color(0, 0, 0)
text3.FontName = "Helvetica"
text3.FontSize = 12

Dim section As Section = Pdf.Sections.Add
section.Paragraphs.Add(table1)
section.Paragraphs.Add(table2)
section.Paragraphs.Add(table3)
section.Paragraphs.Add(table4)
section.Paragraphs.Add(table5)
section.Paragraphs.Add(table6)
section.Paragraphs.Add(table7)
section.Paragraphs.Add(table8)
section.Paragraphs.Add(table9)
section.Paragraphs.Add(table10)
section.Paragraphs.Add(table11)
section.Paragraphs.Add(table12)
section.Paragraphs.Add(table13)
section.Paragraphs.Add(table14)
section.Paragraphs.Add(table15)
section.Paragraphs.Add(table16)
section.Paragraphs.Add(table17)
section.Paragraphs.Add(table18)
section.Paragraphs.Add(table19)
section.Paragraphs.Add(table20)
section.Paragraphs.Add(table21)
section.Paragraphs.Add(table22)
section.Paragraphs.Add(table23)
section.Paragraphs.Add(table24)
section.Paragraphs.Add(table25)
section.Paragraphs.Add(table26)

Dim row1table1 As Row = New Row(table1)
table1.Rows.Add(row1table1)
row1table1.Cells.Add("" & Today.Date, titlefont)

Dim row1table2 As Row = New Row(table2)
table2.Rows.Add(row1table2)
row1table2.Cells.Add("", text2)
row1table2.Cells.Add(Name, text3)
Dim row2table2 As Row = New Row(table2)
table2.Rows.Add(row2table2)
row2table2.Cells.Add("", text2)
row2table2.Cells.Add(Address, text3)
Dim row3table2 As Row = New Row(table2)
table2.Rows.Add(row3table2)
row3table2.Cells.Add("", text2)
row3table2.Cells.Add(Season, text3)
Dim row4table2 As Row = New Row(table2)
table2.Rows.Add(row4table2)
row4table2.Cells.Add("", text2)
row4table2.Cells.Add(Period, text3)

Dim row1table3 As Row = New Row(table3)
table3.Rows.Add(row1table3)
row1table3.Cells.Add("", text1)
Dim row2table3 As Row = New Row(table3)
table3.Rows.Add(row2table3)
row2table3.Cells.Add("", text2)
Dim row3table3 As Row = New Row(table3)
table3.Rows.Add(row3table3)
row3table3.Cells.Add(info1, text3)
Dim row4table3 As Row = New Row(table3)
table3.Rows.Add(row4table3)
row4table3.Cells.Add(info2, text3)

Dim row1table4 As Row = New Row(table4)
table4.Rows.Add(row1table4)
row1table4.Cells.Add("")
row1table4.Cells.Add(t4r1c2, text2)
row1table4.Cells.Add(t4r1c3, text2)
row1table4.Cells.Add(t4r1c4, text2)
Dim row2table4 As Row = New Row(table4)
table4.Rows.Add(row2table4)
row2table4.Cells.Add("", text2)
row2table4.Cells.Add(t4r2c2, text2)
row2table4.Cells.Add("N/A", text2)
row2table4.Cells.Add("N/A", text2)
Dim row3table4 As Row = New Row(table4)
table4.Rows.Add(row3table4)
row3table4.Cells.Add("", text2)
row3table4.Cells.Add(t4r3c2, text2)
row3table4.Cells.Add("N/A", text2)
row3table4.Cells.Add("N/A", text2)
Dim row4table4 As Row = New Row(table4)
table4.Rows.Add(row4table4)
row4table4.Cells.Add("", text3)
row4table4.Cells.Add(t4r4c2, text3)
row4table4.Cells.Add(t4r4c3, text3)
row4table4.Cells.Add(t4r4c4, text3)
Dim row5table4 As Row = New Row(table4)
table4.Rows.Add(row5table4)
row5table4.Cells.Add("", text3)
row5table4.Cells.Add(t4r5c2, text3)
row5table4.Cells.Add(t4r5c3, text3)
row5table4.Cells.Add(t4r5c4, text3)

Dim row1table5 As Row = New Row(table5)
table5.Rows.Add(row1table5)
row1table5.Cells.Add("", text3)

Dim row1table6 As Row = table6.Rows.Add
Dim cell1row1table6 As Cell = row1table6.Cells.Add
cell1row1table6.Paragraphs.Add(image1)

Dim row1table7 As Row = New Row(table7)
table7.Rows.Add(row1table7)
row1table7.Cells.Add("", text1)

Dim row1table8 As Row = New Row(table8)
table8.Rows.Add(row1table8)
row1table8.Cells.Add("", text2)
row1table8.Cells.Add(t8r1c2, text2)
Dim row2table8 As Row = New Row(table8)
table8.Rows.Add(row2table8)
row2table8.Cells.Add("", text2)
row2table8.Cells.Add(t8r2c2, text2)
Dim row3table8 As Row = New Row(table8)
table8.Rows.Add(row3table8)
row3table8.Cells.Add("", text3)
row3table8.Cells.Add(t8r3c2, text3)
Dim row4table8 As Row = New Row(table8)
table8.Rows.Add(row4table8)
row4table8.Cells.Add("", text3)
row4table8.Cells.Add(t8r4c2, text3)

Dim row1table9 As Row = New Row(table9)
table9.Rows.Add(row1table9)
row1table9.Cells.Add("", text3)

Dim row1table10 As Row = New Row(table10)
table10.Rows.Add(row1table10)
row1table10.Cells.Add("", text1)

Dim row1table11 As Row = New Row(table11)
table11.Rows.Add(row1table11)
row1table11.Cells.Add("", text2)
row1table11.Cells.Add(t11r1c2, text2)
Dim row2table11 As Row = New Row(table11)
table11.Rows.Add(row2table11)
row2table11.Cells.Add("", text2)
row2table11.Cells.Add(t11r2c2, text2)
Dim row3table11 As Row = New Row(table11)
table11.Rows.Add(row3table11)
row3table11.Cells.Add("", text3)
row3table11.Cells.Add(t11r3c2, text3)
Dim row4table11 As Row = New Row(table11)
table11.Rows.Add(row4table11)
row4table11.Cells.Add("", text3)
row4table11.Cells.Add(t11r4c2, text3)

Dim row1table12 As Row = New Row(table12)
table12.Rows.Add(row1table12)
row1table12.Cells.Add("", text3)

Dim row1table13 As Row = New Row(table13)
table13.Rows.Add(row1table13)
row1table13.Cells.Add("", text1)

Dim row1table14 As Row = New Row(table14)
table14.Rows.Add(row1table14)
row1table14.Cells.Add("", text2)
row1table14.Cells.Add(t14r1c2, text2)
Dim row2table14 As Row = New Row(table14)
table14.Rows.Add(row2table14)
row2table14.Cells.Add("", text2)
row2table14.Cells.Add(t14r2c2, text2)
Dim row3table14 As Row = New Row(table14)
table14.Rows.Add(row3table14)
row3table14.Cells.Add("", text3)
row3table14.Cells.Add(t14r3c2, text3)
Dim row4table14 As Row = New Row(table14)
table14.Rows.Add(row4table14)
row4table14.Cells.Add("", text3)
row4table14.Cells.Add(t14r4c2, text3)

Dim row1table15 As Row = New Row(table15)
table15.Rows.Add(row1table15)
row1table15.Cells.Add("", text3)

Dim row1table16 = table16.Rows.Add
Dim cell1row1table16 As Cell = row1table16.cells.add
cell1row1table16.Paragraphs.Add(image2)

Dim row1table17 As Row = New Row(table17)
table17.Rows.Add(row1table17)
row1table17.Cells.Add("", text1)
Dim row2table17 As Row = New Row(table17)
table17.Rows.Add(row2table17)
row2table17.Cells.Add("", text2)

Dim row1table18 As Row = New Row(table18)
table18.Rows.Add(row1table18)
row1table18.Cells.Add("")
row1table18.Cells.Add("", text2)
row1table18.Cells.Add("", text2)
row1table18.Cells.Add("", text2)
Dim row2table18 As Row = New Row(table18)
table18.Rows.Add(row2table18)
row2table18.Cells.Add("", text2)
row2table18.Cells.Add(t18r2c2, text2)
row2table18.Cells.Add(t18r2c3, text2)
row2table18.Cells.Add(t18r2c4, text2)
Dim row3table18 As Row = New Row(table18)
table18.Rows.Add(row3table18)
row3table18.Cells.Add("", text2)
row3table18.Cells.Add(t18r3c2, text2)
row3table18.Cells.Add(t18r3c3, text2)
row3table18.Cells.Add(t18r3c4, text2)
Dim row4table18 As Row = New Row(table18)
table18.Rows.Add(row4table18)
row4table18.Cells.Add("", text3)
row4table18.Cells.Add(t18r4c2, text3)
row4table18.Cells.Add(t18r4c3, text3)
row4table18.Cells.Add(t18r4c4, text3)
Dim row5table18 As Row = New Row(table18)
table18.Rows.Add(row5table18)
row5table18.Cells.Add("", text3)
row5table18.Cells.Add(t18r5c2, text3)
row5table18.Cells.Add(t18r5c3, text3)
row5table18.Cells.Add(t18r5c4, text3)

Dim row1table19 As Row = New Row(table19)
table19.Rows.Add(row1table19)
row1table19.Cells.Add("", text2)

Dim row1table20 As Row = table20.Rows.Add
Dim cell1row1table20 As Cell = row1table20.Cells.Add
cell1row1table20.Paragraphs.Add(image3)

Dim row1table21 As Row = New Row(table21)
table21.Rows.Add(row1table21)
row1table21.Cells.Add("", text1)
Dim row2table21 As Row = New Row(table21)
table21.Rows.Add(row2table21)
row2table21.Cells.Add("", text2)

Dim row1table22 As Row = New Row(table22)
table22.Rows.Add(row1table22)
row1table22.Cells.Add("", text2)
row1table22.Cells.Add(t22r1c2, text2)
Dim row2table22 As Row = New Row(table22)
table22.Rows.Add(row2table22)
row2table22.Cells.Add("", text2)
row2table22.Cells.Add(t22r2c2, text2)
Dim row3table22 As Row = New Row(table22)
table22.Rows.Add(row3table22)
row3table22.Cells.Add("", text2)
row3table22.Cells.Add(t22r3c2, text2)
Dim row4table22 As Row = New Row(table22)
table22.Rows.Add(row4table22)
row4table22.Cells.Add("", text2)
row4table22.Cells.Add(t22r4c2, text2)
Dim row5table22 As Row = New Row(table22)
table22.Rows.Add(row5table22)
row5table22.Cells.Add("", text3)
row5table22.Cells.Add(t22r5c2, text3)
Dim row6table22 As Row = New Row(table22)
table22.Rows.Add(row6table22)
row6table22.Cells.Add("", text3)
row6table22.Cells.Add(t22r6c2, text3)

Dim row1table23 As Row = New Row(table23)
table23.Rows.Add(row1table23)
row1table23.Cells.Add("", text3)

Dim row1table24 As Row = New Row(table24)
table24.Rows.Add(row1table24)
row1table24.Cells.Add("", text2)

Dim row1table25 As Row = New Row(table25)
table25.Rows.Add(row1table25)
row1table25.Cells.Add("", text2)
row1table25.Cells.Add(t25r1c2, text2)
Dim row2table25 As Row = New Row(table25)
table25.Rows.Add(row2table25)
row2table25.Cells.Add("", text2)
row2table25.Cells.Add(t25r2c2, text2)
Dim row3table25 As Row = New Row(table25)
table25.Rows.Add(row3table25)
row3table25.Cells.Add("", text2)
row3table25.Cells.Add(t25r3c2, text2)
Dim row4table25 As Row = New Row(table25)
table25.Rows.Add(row4table25)
row4table25.Cells.Add("", text2)
row4table25.Cells.Add(t25r4c2, text2)
Dim row5table25 As Row = New Row(table25)
table25.Rows.Add(row5table25)
row5table25.Cells.Add("", text2)
row5table25.Cells.Add(t25r5c2, text2)

Dim row1table26 As Row = New Row(table26)
table26.Rows.Add(row1table26)
row1table26.Cells.Add("", text3)

Return m

End Function

End Class

hope this makes more sense.

  1. To display the PDF in web browser you need not put it into a stream. Just use public void Save(string,SaveType,HttpResponse);

  2. If you really want to put the PDF into a stream for other reason, you can use public void Save(Stream);. In your code, just add a new line “Pdf.Save(m)” before “Return m”.

Please correct me if I have not understood your question correctly.

Works spot on king thanks very much. much appreciated