SOLVED! Thanks Keith.
I should have noticed your post before I replied… Yay! This works!
Thank you so much. It is perfect!

For testing (and FYI to anyone else who wants to know):
Created a FORM: named  pdf_Viewer.         Form.pdfURL [to store the path as 
per file:/// …]
Added:
• web area: named   web_pdfViewer
• variable: named     dropZone expression type OBJECT   with  ‘droppable’ 
attribute;  ‘on drag over’ and ‘on drop’ as only events
 Then this code in the dropZone script:

C_LONGINT($0)
Case of 

        : (Form event code=On Drag Over)
                  // Accept On Drop event only if the pasteboard contains 
files, reject otherwise.
                If (Get file from pasteboard(1)="")  //no file in pasteboard
                        $0:=-1  //reject drop
                End if 

        : (Form event code=On Drop)  //Requires Droppable action enabled from 
Property List
                $dropName:=Get file from pasteboard(1)
                If (Test path name($dropName)=Is a document)  // if it is a 
document...
                        $droppedFile:=File(Convert path system to 
POSIX($dropName))  // get the FILE
                        If ($droppedFile.isFile)  // is a file!
                                Form.pdfURL:="file:///"+$droppedFile.path
                                WA OPEN URL(*;"web_pdfViewer";Form.pdfURL)
                        End if 
                End if 

End case 

And it displays the PDF in the webArea with ability to scroll through the whole 
document.

I have never used web areas in 4D so I will need to explore the benefits of it. 
I notice it can also be used to display .png files and others dragged into that 
‘dropZone’ variable object on my form.

— Chris


> On Apr 21, 2020, at 9:40 AM, kculotta via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> This worked after adding the third /  WA OPEN URL(*;"wa";"file:///Test.pdf")
> 
>> On Apr 21, 2020, at 10:36 AM, kculotta via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> No one mentioned WA OPEN URL and a web area, which I thought would have been 
>> as easy as WA OPEN URL(*;"wa";"Test.pdf"), but that only resulted in a blank 
>> area.
>> When I did get a pdf to open in the web area, all pages were available.
>> Is that different than what you are asking?
>> 
>> Keith - CDI
>> 
>>> On Apr 21, 2020, at 12:14 AM, Chris Belanger via 4D_Tech 
>>> <4d_tech@lists.4d.com> wrote:
>>> 
>>> Is there a way in 4D to display PDF documents? Either natively inside it 
>>> [with a plug-in, web thingy or otherwise] or by showing in a system pdf 
>>> viewer?
>>> **********************************************************************
>> 
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to