ms-accesspdfvba

How to hide navigation pane in embedded PDF viewer control?


Goal: Trying to provide a embedded preview of a PDF file in a form (first page) without scroll bars, navigation panes etc showing.

Using Adobes PDF ActiveX control (Class AcroPDF.PDF.1), there are embedded PDF files in the MS Access form.

So far I have

pdfControl.src = filePath
pdfControl.setShowToolbar(False) ' hides toolbar (bar along top)
pdfControl.setShowScrollBars(False) ' hides scroll bars since only first page important
pdfControl.setPageMode("none") ' hides bookmarks and thumbs instead of opening by default
    

After this I'm left with just the navigation pane on the left. Using the object browser I went through the functions, could not see anything explicitly mention navigation panes.

Is there a way to hide the navigation pane from the embedded PDF control?

Edit: I've found that you can set a flag to hide the navigation page when opening in a non embedded instance as such

Call Shell("'" & applicationPath & "' /A 'navpanes=0&toolbars=0' '" & filePath & "'", vbNormalFocus)

But I'm still failing to achieve the same thing while embedded.

Edit2: Below is the image where on the left is what I'm trying to get rid of and on the right is what I'm trying to achieve.

enter image description here


Solution

  • Use a Web Browser Control instead. It will use the systems default PDF application to preview the files.

    webBrowserControl.Navigate(filePath & "#toolbar=0&navpanes=0&scrollbar=0")

    There are more parameters that can be used to customize the way you want to open the file in the document below

    https://web.archive.org/web/20210413084849/https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf