how to display pdf in new webpage

I need to create pdf file as well as display that pdf in new web page.Here pdf is created but given pdf is not displayed in the new web page using htmlviewer.Can any one tell me how to do this ??
The code is:

f = GetFolderItem("").Parent.Child("test.pdf")
      CurrentFile = new WebFile
      CurrentFile.Filename = f.Name
      CurrentFile.MIMEType = "application/pdf"
      CurrentFile.Data = pdf.GetBuffer
       webReport.HTMLViewer1.URL = CurrentFile.URL
      webReport.Show

What is pdf.GetBuffer?
Where have you declared ‘CurrentFile’?

Add error checking for ‘f’ to make sure it exists.
You never set ‘f’ to the data of the WebFile?

currentFile is the property of webpage and f is exists

I am new to xojo and i want to display that created pdf file in a new web page

I’m afraid it’s not possible to create PDFs unless you use a third party external additional control

Shouldn’t this work? :slight_smile:

f = GetFolderItem("").Parent.Child("test.pdf")
CurrentFile = new WebFile
CurrentFile = WebFile.Open(f)
CurrentFile.Filename = f.Name
CurrentFile.MIMEType = "application/pdf"
CurrentFile.ForeceDownloload = False
ShowURL(CurrentFile.URL)

Seems he uses DynaPDF already to create the PDF.

[code]webfile = new WebFile
webfile.Data = pdf.GetBuffer
webfile.Filename = “letter.pdf”
webfile.MIMEType = “application/pdf”

		showurl webfile.URL[/code]

This should create webfile which can be send to browser.
To show in new window you may need to use weblink on page and set target to blank.

On a Windows machine, PDF can be displayed natively only in Chrome and Edge. On older browsers, the Adobe Reader plugin is necessary.

Thanks Schmitz it works fine.