Welcome! Log In Create A New Profile

Advanced

WB22 - Report To PDF

WB22 - Report To PDF
September 27, 2018 08:54PM
Hi All

I am printing to a pdf and then loading it into the browser. Here is my code:

sFile is string = fDataDir()+"\"+DateSys()+TimeSys()+".pdf"

iDestination(iPDF, sFile)

iPrintReport(RPT_RollCallList)

FileDisplay(sFile, "application/pdf")

fDelete(sFile)

I need the pdf to be sent to a separate tab so that when it is closed the page that it is called from will be returned to? At the moment it opens on the same tab that the report is called from.

Cheers
André
Re: WB22 - Report To PDF
September 27, 2018 09:11PM
Hi André,

the button in which this code is should have a setting of "new browser" on the first tab.

And you should REMOVE the fdelete, as the file will in some case be deleted before it can be displayed.

best regards

Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on [www.fabriceharari.com]
Re: WB22 - Report To PDF
September 27, 2018 09:54PM
Hi Fabrice

The maestro strikes again - cool - that sorted it.

On the matter of deleting the file - how do you deal with removing these temporary files going forward?

Cheers
André
Re: WB22 - Report To PDF
September 28, 2018 03:21PM
Hi André,

to remove the old files, at the beginning of the code to print a new report, I check the date time of the files in that directory, and I delete anything older than 24hours...

You already have the datetime in the name, you just need to move your files to a subdirectory for that process to be extremely fast.

This will also allow the user to download the file after they read it in their browser.

best regards

Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on [www.fabriceharari.com]
Re: WB22 - Report To PDF
September 28, 2018 07:16PM
Hi Fabrice

Thanks - will try something like that.

Cheers
André
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: