yarn @react-pdf-viewer/core 3.4.0
Set the initial tab

latest releases: 3.12.0, 3.11.0, 3.10.0...
2 years ago

New feature

  • It's possible to set the initial tab
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout';

const defaultLayoutPluginInstance = defaultLayoutPlugin({
    // The `Bookmark` tab is active initially
    setInitialTab: () => Promise.resolve(1),
});

According to the PDF specifications, the initial tab can be determined based on the document's page mode.
If you want to follow that behaviour, then you can use the setInitialTabFromPageMode function:

import { defaultLayoutPlugin, setInitialTabFromPageMode } from '@react-pdf-viewer/default-layout';

const defaultLayoutPluginInstance = defaultLayoutPlugin({
    setInitialTab: setInitialTabFromPageMode,
});

Improvement

  • Smooth scroll when jumping to a given page or destination (clicking a bookmark, for example)

Bug fixes

  • Can't add highlight to selected text
  • Keep current position after zooming

Don't miss a new core release

NewReleases is sending notifications on new releases.