MBSDynaPDF table on Web app

I’m trying to test making a PDF with a table in a Web app using MBSDynaPDF. I changed the simple “Create PDF” Project in the Web Examples folder, using this simple Create method, which is just trying to put a one-row two-column table on the page:

[code]Dim d As New date
dim f as FolderItem = SpecialFolder.Desktop.Child(“Create PDF.pdf”)

pdf.SetLicenseKey “Starter”
call pdf.CreateNewPDF nil
call pdf.SetPageCoords pdf.kpcTopDown
Call pdf.Append

Dim table As DynaPDFTableMBS = pdf.CreateTable(1, 2, 500, 25)
Call pdf.SetFont “Arial”, pdf.kfsNormal, 8.0, True, pdf.kcp1252
Call table.SetCellText(0, 0, 1, 1, “Row One Cell One”)
Call table.SetCellText(0, 1, 1, 1, “Row One Cell Two”)
Call table.DrawTable(50, 100)

call pdf.EndPage
call pdf.CloseFile[/code]

The button that calls the above method is unchanged:

[code]Dim pdf As New MyDynapdfMBS

create pdf

CurrentFile = new WebFile
CurrentFile.Filename = “test.pdf”
CurrentFile.MIMEType = “application/pdf”
CurrentFile.Data = pdf.GetBuffer

HTMLViewer1.URL = CurrentFile.URL[/code]

Nothing shows on the page when executed.

That line isn’t needed.

CurrentFile is a property?

call table.AddRow

You missed to add rows to the table.

[quote=387533:@Christian Schmitz]call table.AddRow

You missed to add rows to the table.[/quote]

Ah, I see that I need that. Now, is there a way to get columns to expand based on the width of the data entered?

You may need to calculate a width based on the text you have and use SetColWidth to set the width.
Height of cells is automatically calculated.

Ok. I’m getting it now. Thanks, Christian.

It looks like the CreateTable Width parameter must equal or greater than the widest SetColWidth parameter.

Yes. It’s used by the button that calls the second method above. It’s taken from your example file.