Avatar of João serras-pereira
João serras-pereira
Flag for Portugal asked on

saving web browser control content as image javascript

Hi. I have a form (invoked within the ms/access web browser) that is invoking a url where run a javascript code that I prepare.


The arguments for invoking are prepared in my app and it runs OK. But now I need to save the image content of the page in a local file for further processing.


I know that I need to change the javascript code to automatically save the page as a image file and add, automatically, one additional argument that is the file name.

I need to, automatically (because we have many thousandths of images), generate picture files from the content of the web browser form (I am sending in 2 screenshots (for the access db and for the form).



Can anyone tell me what would be the code? Of course, I can share my source java code.





JavaScriptMicrosoft Access

Avatar of undefined
Last Comment
João serras-pereira

8/22/2022 - Mon
João serras-pereira

ASKER
oops
missing images

David Favor

This is fairly trivial using a LAMP Stack.

If you get no comments related to doing this using Windows tech, consider switching to a LAMP Stack.
João serras-pereira

ASKER
Hi

What is a Lamp stack?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
João serras-pereira

ASKER
In fact, what I think I need to do should be straightforward, but I am putting my question on the wrong way and I need to close it and reopen as another question. My page is written in javascript, so what I need is to know how to, in javascript, save the page content as a file.


Scott Fell

I am going to have to disagree with David here. It does not matter if you are using Windows or Linux.

I am not clear on what you are doing, but if you are presenting data to a web browser that gets puzzled together to make a page, you can use a library like https://html2canvas.hertzen.com/ to take a "screenshot" and save the image.

It also sounds like you may be doing something similar to how Google Earth works.  You may be able to take advantage of the api https://developers.google.com/maps/documentation/javascript/maptypes


 
João serras-pereira

ASKER
Hi,

I think I did not post my question in a proper manner. I am so sorry for that.
As per the screenshots you see, my software shows the image in a correct manner. But I have many thousands of images to generate at several distances. So I badly need a batch process  that generates the image (done) and then generates an image file containing the image.
This means that I should modify the current javascript code so, after "showing", it will "screenshot" the image to a file, something in the line of

Downloading and saving an HTML canvas as an image using Javascript (instructobit.com)
or
javascript - How to save the contents of a div as a image? - Stack Overflow

But as I am a real rookie on javascript, I do not really understand the code and so, I am begging help on this as I could destroy the web page and get to nowhere...


Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Scott Fell

are the images stored in Access? or is just the data stored in Access? or a combination that data is overlaid on an image you already have?

what will help is if you can detail you workflow so we can understand how this works.
João serras-pereira

ASKER
Oops... Sorry... Missed your reply!

The images are got from invoking BING MAPS from within MS/Access and seen using its web browser.

From access I generate a string that updates an "empty" page on my server site (the page contains only javascript code). After doing the string generation (actually a series of calls to javascript functions previously stored in the page) I run the page and get what I need

But now, I need to "screenshot" those images in batch....

If you want I may share the page code with you as well as the constructed string...

Hope this is good enough...

so, wrapping up:

TODAY

1. the user clicks a MS/Access button
2. I Open a form that contains a web browser control
3. Upon loading I generate a string for showing a map using Bing Maps
4. I run the code in the page and it shows the image that you see above.

Novel function

1-. The user clicks a button
2. I go thru all coordinates
   2.1 open the form
   2.2 generate the string
   2.3 add to the string the "screenshot" functionality
   2.4 run the page and get the image on a folder


kindest regards

ASKER CERTIFIED SOLUTION
Scott Fell

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
João serras-pereira

ASKER
Thanks!!!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy