Search code examples
vbams-accesspdfprinting

Printing PDF file specific pages using vba


Windows allows us to print specific PDF files manually from the printing options. I only need a PDF reader (which can be free) to open the file, then print it by entering specific page numbers. However I couldn't find doing this process programmatically without using any third party licensed PDF program or library.

I am looking way to do this using MS VBA 2003. Is it possible?


Solution

  • I did what I aimed by using an COM exposed C# application.

    The PDF printing library was easy to find as a C# .NET project, therefore I produced my own .dll file by creating a .NET C# Class library project. In this application, I used the library called PdfSharp which is opensource. I wrote my code in order to expose it to COM.

    After I registered my produced .dll and created a .tlb file, I referenced this .tlb file to my Access Visual Basic editor. Voila! it worked perfect.