Avatar of João serras-pereira
João serras-pereiraFlag 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
Avatar of João serras-pereira
João serras-pereira
Flag of Portugal image


User generated imagemissing images
User generated image
Avatar of David Favor
David Favor
Flag of United States of America image

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.
Avatar of João serras-pereira



What is a Lamp stack?
Avatar of João serras-pereira


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.

Avatar of Scott Fell
Scott Fell
Flag of United States of America image

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

Avatar of João serras-pereira



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)
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...

Avatar of Scott Fell
Scott Fell
Flag of United States of America image

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.
Avatar of João serras-pereira


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:


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

Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of João serras-pereira


Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo