Printing a Browser Widget
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Printing a Browser Widget
Mac on Mojave, LC Community 8.2.0 and 9.0.3
I have a browser widget alone on a card which displays a simple HTML text table. I clone this card 25 times while randomizing the text in the tables - all so far so good.
When I go to print the 25 randomized cards, they all appear blank when I look at them in Preview via the printing dialog. I can see the tables on the cards, but they don't seem to print. Suggestions?
I then thought that I could use the snapshot command to grab the browser and turn it into a PNG that I would then paste into a graphic that I created over the browser rectangle. I used the tutorial on creating a thumbnail and tried to set the imagedata of my image to the imagedata from the snapshot. My images all remained empty.
Any help on either approach would be appreciated.
Thanks
Kelly
I have a browser widget alone on a card which displays a simple HTML text table. I clone this card 25 times while randomizing the text in the tables - all so far so good.
When I go to print the 25 randomized cards, they all appear blank when I look at them in Preview via the printing dialog. I can see the tables on the cards, but they don't seem to print. Suggestions?
I then thought that I could use the snapshot command to grab the browser and turn it into a PNG that I would then paste into a graphic that I created over the browser rectangle. I used the tutorial on creating a thumbnail and tried to set the imagedata of my image to the imagedata from the snapshot. My images all remained empty.
Any help on either approach would be appreciated.
Thanks
Kelly
Re: Printing a Browser Widget
Hi.
This is an interesting question to me, because I do not use widgets.
But I made a stack with two cards, each with a browser widget that was set to the LC home page. Each card's widget worked just fine. I put a field on card 1 as well.
But when I went to print the cards, I got nothing but the field.
LC 9.0.3 Mac 10.13.4
So, anyone?
Craig Newman
This is an interesting question to me, because I do not use widgets.
But I made a stack with two cards, each with a browser widget that was set to the LC home page. Each card's widget worked just fine. I put a field on card 1 as well.
But when I went to print the cards, I got nothing but the field.
LC 9.0.3 Mac 10.13.4
So, anyone?
Craig Newman
Re: Printing a Browser Widget
Print/PrintToPDF is not supported by the browser widget.
It is on the long list of LC promises for LC 9.
But, of course, you can make a snapshot from (the rect of) the widget and print that, even very long pages:
Use "BrowserSnapshot_v015": (sorry, currently not available)
It is on the long list of LC promises for LC 9.
But, of course, you can make a snapshot from (the rect of) the widget and print that, even very long pages:
Use "BrowserSnapshot_v015": (sorry, currently not available)
Last edited by [-hh] on Wed Dec 11, 2019 11:47 pm, edited 1 time in total.
shiftLock happens
Re: Printing a Browser Widget
Oddly enough, when I tried just that, I got an error
However, I was able to export a snapshot of the general area of the widget (but only by shooting the stack). Go figure.
Re: Printing a Browser Widget
Could someone give me a code fragment on how you are doing the snapshot?
I tried that but the rectangle seemed to have an issue between global and window coordinates. The other issue was that the snapshot seemed to be random static - tearing of the image so that columns & rows don’t line up.
Thanks
Kelly
I tried that but the rectangle seemed to have an issue between global and window coordinates. The other issue was that the snapshot seemed to be random static - tearing of the image so that columns & rows don’t line up.
Thanks
Kelly
Re: Printing a Browser Widget
Code: Select all
if there is no img "temp" then create img "temp"
put globalLoc(the topleft of widget "browser"), \
globalLoc(the botright of widget "browser") into rct
export snapshot from rect rct to img "temp" as PNG
shiftLock happens
Re: Printing a Browser Widget
Thanks!
The global additions should help.
Could you add a couple more lines to put the snapshot into an image “theImage” that I already have on the card to cover the browser widget. With the ‘wallpaper’ image covering the browser, I’m hoping I can then print the card.
Thanks
The global additions should help.
Could you add a couple more lines to put the snapshot into an image “theImage” that I already have on the card to cover the browser widget. With the ‘wallpaper’ image covering the browser, I’m hoping I can then print the card.
Thanks
Re: Printing a Browser Widget
You cannot put an image on top of a browser widget (which is a native display).
So lock screen, show the widget, do the snapshot as above (use "theImage" instead of "temp"), hide the widget, set topleft of image "theImage" to the topleft of widget "browser".
Depending on your CPU/GPU you have to "wait 10 ticks with messages" after step 2.
So lock screen, show the widget, do the snapshot as above (use "theImage" instead of "temp"), hide the widget, set topleft of image "theImage" to the topleft of widget "browser".
Depending on your CPU/GPU you have to "wait 10 ticks with messages" after step 2.
shiftLock happens
Re: Printing a Browser Widget
i'll try that this evening when I get back to LiveCode.
Thanks for the quick help.
Kelly
Thanks for the quick help.
Kelly
Re: Printing a Browser Widget
That belongs in the Department of Subtle! How is a newbie ever going to... <Despair>
Re: Printing a Browser Widget
When writing snapshot from (the rect of) widget I meant that
"export snapshot from widget"
is not possible, so we have to use
"export snapshot from rect <rectangle>".
With this form <rectangle> is *always* in *global* coordinates.
So we could have a function globalRect to write
Here is the function.
p.s. globalRect(the rect of this card) = the rect of this stack.
"export snapshot from widget"
is not possible, so we have to use
"export snapshot from rect <rectangle>".
With this form <rectangle> is *always* in *global* coordinates.
So we could have a function globalRect to write
Code: Select all
export snapshot from rect globalRect(the rect of widget "browser") to img "temp" as PNG
Code: Select all
function globalRect pRect
return the globalLoc of (item 1 to 2 of pRect), \
the globalLoc of (item 3 to 4 of pRect)
end globalRect
shiftLock happens
Re: Printing a Browser Widget
kdjanz, my assumption was wrong (happens )
While there are edge cases where something like that will trip you up, by the time you hit them, you will no longer be a newbie, so take heart