目录

How do I hide the PDF operation button bar during PDF preview?

Solution

Add the #toolbar=0&navpanes=0 parameter to the URL to hide the PDF operation button bar.

Reference code

import { webview } from '@kit.ArkWeb';

@Entry
@Component
struct HidePDFToolbar {
  controller: webview.WebviewController = new webview.WebviewController();

  build() {
    Column() {
      // Hide the toolbar (toolbar=0) and navigation pane (navpanes=0) through URL parameters
      Web({ src: 'resource://rawfile/test.pdf#toolbar=0&navpanes=0', controller: this.controller })
        .domStorageAccess(true)
        .width('100%')
        .height('100%')
    }
    .width('100%')
    .height('100%')
  }
}