Forum moved here!

Home / Using Sumatra PDF in an MS Access form

LaurentB

Hi,

I am trying to replace a web browser object acrobat control in an Access form VBA with sumatradpf as we have too many problems with forced Acrobat autoupdates.

Knowing there is no activex controls or any other way than command line controls for sumatra, would it be possible trough vba to fix the sumatra window inside an Access form ?

PS : here is what I found so far but it is for VB and not vba: http://www.vbforums.com/showthread.php?839415-Embed-Sumatra-PDF-Reader-into-a-Form

Many thanks for your help on this matter.

Laurent.

GitHubRulesOK

Generally SumatraPDF is not intended to be “embeded” since such use could breach licensing. see License - Commercial use / Distribution with 3rd Party Software

The unmodified binary can be very easily run to open a numbered page of a known pdf object as a second child window without breaching license.
Startup sequence with a stored screen co-ordinate is possible but it will be a normal seperate window.

There were/are ways to use the plugin features but you would probably need to provide a working model or publish your code as AGPLv3 to confirm it does not conflict with SumatraPDF AGPLv3 License.

LaurentB

Hi,

I didn’t know that, but I don’t think it would be an embeded sumatrapdf application, just a place where the application should show. The idea of an object in Access is easy as the pdf reader stays always at the same place.

As you mentenion, if there is a startup coordinates I could apply than maybe that should be fine for me. I suppose there are part of the command line parameters. I will try with this first to see if it can help.

I am working in a public federal company and this is a access db that open pdf to be read for 4 people (it helps people find the documents without have to browse to folder structure)

GitHubRulesOK

The start co-ords are in the settings file. You can make SumatraPDF open a fixed copy by overwrite before starting the session with -appdata which can also be -restricted for “kiosk” modes to reduce user interference

LaurentB

Ok, I tried the -restrict option and seems to give a nice result but I should show the pdf at two different places based on the opened access form so the coordinates locked at oneplace only don’t work.

Moreover, using the window as external on the access form hides it every time I need to fill in a textbox in the form so it is not a working solution.

That’s so sad, Sumatrapdf is so lightweight and opens pdf faster than anything else. Do you think that in the future an activex control will be developped for this amazing pdf reader (or something similar, I am not an It expert)?

GitHubRulesOK

The position control should be adequate for most cases to fix the position
WindowPos = x y w h

Using -appdata “folder\SumatraPDF-settings.txt” you can call multiple seperate stored positions say one for viewing and one for annotation or reference / compare etc. you can use shortcuts in one window to open the second.

Using minimise and restore it should not interfere with underlying app window. Equally if you need SumatraPDF to be “always on top” there are many ways to achieve that.

There is an old plugin mode similar to embeded use but its very limited in usage as it was primarily for NP API web browsing
image
see Browser NPAPI plugin (current suggestions)?

The core of MuPDF can be provided comercially as embedded, host-based, mobile or cloud applications API toolkit from https://artifex.com/licensing/commercial/

LaurentB

Hi again,

Thanks for all your answers. In the access form I am using an auto resize feature that looks at the form size and cycle trough all the objects to resize it. (The users have two screens with different resolutions and can then resize the access form to their liking)

To be honest, having an object outside the form to control also will become difficult as I already spent a lot of time on this small database.

What they need is to read the pdf, scrolling and sometimes use the select tool to copy paste some text from the document.

Maybe this plugin can be used within access as a webbrowser object or similar. But as you said in the beginning would this be problematic in regard to your license ?

GitHubRulesOK

I am not the developer so can’t say what is permissive, but you would need to outline with some detail the core usage. The intended audience is a factor e.g. in house use only, no commercial resale. Clear knowledge that the binary could just as easily be used by staff as a standalone application independent from any calls from your companion database. etc.

Plugin usage is using old techniques AFAIK cannot be driven by DDE and notoriously dificult to resize (e.g. cannot be changed on the fly unlike some settings by simply poking the settings file) and depreciated thus unsupported but does work in the resizable test app see https://github.com/sumatrapdfreader/sumatrapdf/issues/456

SumatraPeter

There are ActiveX controls for PDF display etc. already - a simple web search returned a bunch of promising results (Amyuni for example - never used and not as endorsement).

If you expect Sumatra’s sole dev to create such a control anytime soon (or ever), I’d suggest looking elsewhere. As noted above even the browser plugin is no longer being developed. Maybe your company can even pay someone to create a custom control for you guys using MuPDF (which Sumatra itself uses) or other PDF library, license permitting of course.

LaurentB

Thank you for the information. As I said I am not an expert in developping things, Vba from office is quite enough form me. At the moment the application works with the webbrowser object and run fine on my computer but this relies on which application is defined by default on the computer and can’t use Sumatradpf.

As this is intended for 4 people inhouse and no commercial use, I won’t get any budget to buy anything.

Thanks a lot for at least giving me some hints and tryed to help me.

Keep the good work, Sumatrapdf as a pdf reader is fantastic and I always recommend it.

GitHubRulesOK

It may help us understand to show some relevant progress so far
Screenshots even slightly fuzzy markups give an overview of intent and trimmed down code snippets even working in a slightly dfferent way say using notepad file.txt or paint with an image help undestand your workflow.

It is posible to still run current SumatraPDF in Waterfox Classic or other legacy mozilla browser as shown in 5th post above

There was an activex translator that worked with vba calls to firefox in place of IE but do not know if it will still work with waterfox the site was working with downloads available november last year https://web.archive.org/web/20191126160928/http://www.iol.ie/~locka/mozilla/control.htm
That needs to be installed/registered with regsrv32 as per that site
you may need to browse around for examples but a snippet was

Private Sub UserForm_Activate()
Me.MozillaBrowser1.Navigate ("http://www.mrexcel.com/board2/viewtopic.php?p=1182388")
End Sub

see https://www.mrexcel.com/board/threads/using-firefox-instead-of-ie-for-vba-web-browsing.236618/

LaurentB

Hi,

Sorry for the late answer. I didn’t see there was another reply. So far I decided to go with the “webbrowser” object available in Vba. You gave a correct example on how to use it above.

  1. Declare the object
  2. use browser.navigate (pdfdoc)

Anything else is simply related to fill in a database from copy pasting or commenting the pdf document.

The issue with the webbrowser is that it is dependend of the installed browser plugin (acrobat reader for example) which 2 of the 4 users have problem with. (very slow doc opening) and everytime there is an acrobat update pushed the application stop working until the update is finished.

My initial idea was to find a way to use sumatrapdf because it is lightweight and has a good performance and there is no anoying lateral useless bars showing during reading. That’s all.

To be honest, I had to move to another project because of the timing constraints and the issue with copyright that could arise using your product in my little application. (Acrobat reader is part of the company application package, so it doesn’t work but it is legal to use it).

AS soon as the other project is done I can investigate on the information you provided.

Sincerely Yours,
Laurent.

GitHubRulesOK

Thanks fo feedback, without a copy of Access VBA, unless you could mock up a similar form in powershell/VBA to test the suggestions, I possibly cannot help much more at this stage.
Re licensing/copyright if it is installed as a conventional binary working version 2.5.2 (includes 32bit browser dll), or use a similar binary developer 64bit variant.Then you can install/update to a recent standard SumatraPDF thus you are still compliant with AGPL3 even if your in-house app is running that registered dll in the background.