Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 7 Monaten, 4 Wochen
Letzter Beitrag:
vor 7 Monaten, 4 Wochen
Beteiligte Autoren:
John Fligg, David Cabrera, Fabrice Harari, Luis Antonio Gutiérrez Flores

How to open a PDF file when a Web page opens?

Startbeitrag von John Fligg am 20.02.2017 14:06

I have a standard WebDev Dynamic Page and want to open a PDF file when the page has opened:

IF gsPDFName "" THEN
FileDisplay(gsPDFName, "application/pdf")
END

However wherever I put the code either the opening of the page takes precedent or the opening of the file does.

How can I open the page and when loaded open the PDF file please?

BTW OnLoad does not work.

Thx.

Antworten:

Hi John,

first you would have to define precisely what you mean by "open a pdf":
- display it in a field of the current page? (use an image field)
- display it in another tab of the browser? (execute the code of a button with NEW as destination, and the filedisplay inside the button code)
- open it in acrobat reader like what happens when you double click on in the file explorer? (NOT POSSIBLE from a web site)

Best regards

von Fabrice Harari - am 20.02.2017 14:16
Thanks.

Option 2 - display it in another tab of the browser.

Here is my code...

IF bPrint = True THEN
FileDisplay(gsPDFName, "application/pdf")
END

PageDisplay(PAGE_Loop_Contact, "F")

Using the debugger the file is displayed in another tab just fine. The code has gone on to the PageDisplay as FileDisplay does not lock the process. However Page_Loop_Contact is not opened.

von John Fligg - am 20.02.2017 14:21
Hello John!

Instead of doing a PageDisplay and then in that new Page doing a FileDisplay go to your button that does the PageDisplay, and click on the description and on the General Tab change the "Destination" to New Browser (_blank). With this instead of doing the PageDisplay just do the FileDisplay and it will open the PDF in a new browser tab.

von Luis Antonio Gutiérrez Flores - am 20.02.2017 22:27
Thx. The problem is there is no button calling the PageDisplay. This is part of some opening code in my app.

However what I have done is simply print the file to PDF but not display it. Then when the window opens I check to see if the file is there and if so unhide a button that will then open the file.

von John Fligg - am 20.02.2017 23:06
Hi John

What you can do is use a hidden button, in the button put the code FileDisplay () and in the description is defined that opens in a new tab of the browser, and that at the beginning of the page you make an ExecuteProcess (BTN_Button, trtClick) To the button so that he takes care of opening the PDF in a blank tab.

I'm sorry for my English
best regards
David Cabrera

von David Cabrera - am 21.02.2017 00:02
Excellent. Obvious really

Thanks to all.

von John Fligg - am 21.02.2017 00:15
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.