Printing from the Browser widget

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Printing from the Browser widget

Post by richmond62 » Tue Mar 16, 2021 10:21 am

Is a load of old cack:
-
PrintBrowser.jpg
-
yielding a blank page.

Aaaaaaaah: https://www.forums.livecode.com/viewtopic.php?t=32387

"Print/PrintToPDF is not supported by the browser widget.
It is on the long list of LC promises for LC 9."

That was March 2019: 2 years ago!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing from the Browser widget

Post by richmond62 » Tue Mar 16, 2021 10:32 am

So: I'd thought I'd try and be "clever" (I never learn) and try this:

Code: Select all

import snapshot from widget "Browser"
AND, wonders-will-never-cease, I got a totally useless transparent image.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing from the Browser widget

Post by richmond62 » Tue Mar 16, 2021 10:49 am

This seems OK:

Code: Select all

on mouseUp
   set the height of stack "Browser Basher" to ((the height of widget "WB") + 24)
   set the top  of stack "Browser Basher" to 200
   wait 2 secs
   put the rect of widget "WB" into REX
   put the windowID of stack "Browser Basher" into GLAZIER
   import snapshot from rect REX of window GLAZIER
   set the name of the last image to "PICPRINT"
   end mouseUp
Until one works out that the image, while being (in this case) 2400 tall, only contains
pictorial material the size of the stack BEFORE the resize . . .

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Printing from the Browser widget

Post by jmburnod » Tue Mar 16, 2021 10:59 am

Hi Richmond,

This work here (LC 9.6.1)

Code: Select all

on getImgFromWidget
   put globalLoc(topleft of widget 1 ) into tTL
   put globalLoc(bottomright of widget 1 ) into tBR
   import snapshot from rect tTL,tBR 
end getImgFromWidget
Kind regards
Jean-Marc
https://alternatic.ch

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”