Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 10 Monaten
Letzter Beitrag:
vor 10 Monaten
Beteiligte Autoren:
DarrenF, D Wilson, Arie, Stefan Bentvelsen, Fabrice Harari

[WD21] Storing and printing a PDF document

Startbeitrag von DarrenF am 21.01.2017 13:55

Hi guys,

I have a report (an invoice) that I want to store to disk as a PDF document and I also want to give the user the option to print it directly to the printer. I don't mind if the preview window pops-up or not, but how is this done without re-running with iPrintReport function? I assumed it would be easy - but do I really need to re-run iPrintReport with a different set of iDestination, iParameter functions??

I've come up with the following code to generate the PDF invoice, give it a filename and then store it to disk:


iDestination(iPDF,gsDocuments + sTempFilename)
iParameterPDF("","",iProtectionSelection+iProtectionModification)
iPrintReport(RPT_ContractorInvoice,InvoiceHeader.ID)


...but how to print the PDF afterwards? Can't use iPrintPDF because that's not availoable to WD :sneg:

Antworten:

Hi Darren

you can :
- print your report as pdf as you are doing
- display it in your own preview window (using a looper with an image control in it, and displaying each page on a line)
- print it on paper using iprintimage (you are displaying each page as an image that you can print)

Best regards

von Fabrice Harari - am 21.01.2017 14:21
Ah, good thinking Fabrice... I'll give it a go - Thanks!

von DarrenF - am 21.01.2017 15:13
I am a new user of Windev this is my first reply/question so my questions may seem 'basic' to more experienced users.
How would I save the created pdf to an record in the database?

von D Wilson - am 21.01.2017 16:57
Hi D Wilson,

you can store it in a binary memo in a record with HLinkMemo(), or you can save the pdf in a map and only store the pathname of the pdf in a record.

von Stefan Bentvelsen - am 21.01.2017 18:49
Thanks for the help. Like I said I am just getting started. The help and advice from the more experienced is appreciated.

von D Wilson - am 21.01.2017 19:01
Hi Darren,

another approach would be to generate the ODF from your appliaction (which means print it once) and then use Acrobat to print it in the background like
"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /t  file.pdf "my printer-name"
Of course the acrobat reader has to be installed on each client computer

There is also an option in WD to print it to a WD duplicate file. Never used it but this is some kind of WD internal format. You can then use this file to generate a PDF or print it to a printer. I assume the printout is not regenerated, but printed as-is, thus faster. This means 3 actions to do, I know, but maybe the last 2 can be done in the background?

von Arie - am 22.01.2017 11:17
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.