How to email report from web app - Valentina Reports

Background:
Web app creates a report which is visible with ShowURL(mPDF.URL) or using ExecuteJavaScript “window.open(’” + mPDF.URL+ “’,‘blank’)”
mPDF is a Webfile with MimeType = “application/pdf”

Xojo ver 2014 1.1, Valentina ver 5.5.5

The Problem:
The .pdf file does not get added when attempting to attach the report via email. The code below returns an empty file which gets attached.

[i]file = New EmailAttachment
file.loadFromFile GetFolderItem(mPDF.URL)[/i]     ' Also tried with FolderItem.PathTypeURL
[i]mail.attachments.append file[/i]

Have tried pushing the URL as a string to troubleshoot and ensure the correct path is being passed but still only blank attachment.

Any assistance will be most appreciated.

I think you’ll need to save the pdf to an actual file instead of trying to create one from the webfile URL. You can use the Valentina PrintToDIsk method to do that. Then, if you still want to display the pdf you can create a webfile from the saved file.

Thanks Jay, It doesn’t look like the VReport class supports the PrintTodisk method for web apps. It works fine on client based apps. Maybe Ruslan will be able to confirm if this is the case.

I have temporarily got around the problem by pushing the report as the message body ie

Dim htmldata As String = report.PrintToBuffer( EVReportPrintType.kToHTML, 1)

and then

mail.bodyHTML = htmldata

This is OK for this report but will not be suitable for others that have to be PDF.