Access Modern Web Browser Control – Merging PDFs

Have you ever wanted to merge PDFs using VBA and not wanted to use ActiveX controls, 3rd party dlls, …

Now that we have a new Modern Web Browser control:

 

we can finally do what has been so easy to do via the web for over a decade now!  That’s right, we can employ the web browser to enable us to create and manipulate PDFs!

The Basic Concept

For years, the web development community has had a number of different PDF javascript libraries that can create and manipulate pdfs with great ease.  I set out to develop this solution in 2020, but quickly came to the realization that the old web browser control couldn’t do the job because it didn’t support JS promise, canvas, …

Luckly for us, we finally have a modern browser that does properly support all of the above and I was able to retake my original work and finalize it.

I designed a simple interface to merge 2 documents together, but in reality it is very easy to enable it to merge 3, 4 or more documents together in one go if you have such a need.

Access PDF Merge

So, you need only select the 2 files to merge together, assign a name to give the new PDF document and click the Merge button, et voilà!

And yes, it is even possible to fully automate the process. So you could pull paths/files from Access and perform a merge without any user intervention.
 

The PDF Library

For the purposes of today’s article, I will be using pdf-lib to perform the manipulations of the PDF document(s).  That said, there are a number of alternatives and you can just as equally use any of those if you wish!
 

Demo Database

Feel free to download a 100% unlocked copy of a sample database I have put together to illustrate some of what is discussed above by using the link provided below:

Download “PDF Merge” PDFMerge.zip – Downloaded 6004 times – 1.42 MB  

Notice About Content/Downloads/Demos

Disclaimer/Notes:

If you do not have Microsoft Access, simply download and install the freely available runtime version (this permits running MS Access databases, but not modifying their design):

Microsoft Access 2010 Runtime
Microsoft Access 2013 Runtime
Microsoft Access 2016 Runtime
Microsoft 365 Access Runtime

All code samples, download samples, links, ... on this site are provided 'AS IS'.

In no event will Devhut.net or CARDA Consultants Inc. be liable to the client/end-user or any third party for any damages, including any lost profits, lost savings or other incidental, consequential or special damages arising out of the operation of or inability to operate the software which CARDA Consultants Inc. has provided, even if CARDA Consultants Inc. has been advised of the possibility of such damages.

 

 

Coming Up Next!
In my next article, coming out in the coming days, we will look at how easy it is to split a PDF to extract a range of page(s).

I have a couple other interesting projects that couldn’t work because of the limits of the older browser control, so in time I will hopefully show you all some other interesting capabilities now that Access has finally caught up with the real world!

Additional Resources

6 responses on “Access Modern Web Browser Control – Merging PDFs

  1. EightYuan

    A quick question: does MS have any plans to add this web browser control to other flavors of VBA, e.g., Excel VBA? Or can I access this via a reference (from within Excel VBA) to the Access API?