Skip to content

[Bug] Left and right keys to skip pages not working when zoom is set to "Fit page" #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GnoxNahte opened this issue Apr 13, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@GnoxNahte
Copy link

Steps to reproduce

  1. Imported pdf
  2. Change view mode to "Fit page"
  3. Try to skip pages using Left and right arrows
    Did in sandbox vault with only PDF++ installed

Expected behavior

Expect to skip pages, like how it works in "Fit width"/"Fit height".

Actual behavior

Nothing happens

Screen recordings or screenshots

Image

Wrote my actions on the side panel as I can't show my key presses

Debug info

Obsidian debug info

  • Obsidian version: 1.8.9
  • Installer version: 1.8.4
  • Operating system: Windows 11 Home 10.0.26100
  • Use [[Wikilinks]]: false
  • Base color scheme: dark
  • PDF "Adapt to theme": false
  • Community theme: none
  • Snippets enabled: 0
  • Plugins installed: 1
  • Plugins enabled: 1
    • PDF++ v0.40.28

PDF++ debug info

{"settings":{"displayTextFormats":[{"name":"Title & page","template":"{{file.basename}}, p.{{pageLabel}}"},{"name":"Page","template":"p.{{pageLabel}}"},{"name":"Text","template":"{{text}}"},{"name":"Emoji","template":"📖"},{"name":"None","template":""}],"defaultDisplayTextFormatIndex":0,"syncDisplayTextFormat":true,"syncDefaultDisplayTextFormat":false,"copyCommands":[{"name":"Quote","template":"> ({{linkWithDisplay}})\n> {{selection}}\n"},{"name":"Link","template":"{{linkWithDisplay}}"},{"name":"Embed","template":"!{{link}}"},{"name":"Callout","template":"> [!{{calloutType}}|{{color}}] {{linkWithDisplay}}\n> {{text}}\n"},{"name":"Quote in callout","template":"> [!{{calloutType}}|{{color}}] {{linkWithDisplay}}\n> > {{text}}\n> \n> "}],"useAnotherCopyTemplateWhenNoSelection":false,"copyTemplateWhenNoSelection":"{{linkToPageWithDisplay}}","trimSelectionEmbed":false,"embedMargin":50,"noSidebarInEmbed":true,"noSpreadModeInEmbed":true,"embedUnscrollable":false,"singleTabForSinglePDF":true,"highlightExistingTab":false,"existingTabHighlightOpacity":0.5,"existingTabHighlightDuration":0.75,"paneTypeForFirstPDFLeaf":"left","openLinkNextToExistingPDFTab":true,"openPDFWithDefaultApp":false,"openPDFWithDefaultAppAndObsidian":true,"focusObsidianAfterOpenPDFWithDefaultApp":true,"syncWithDefaultApp":false,"dontActivateAfterOpenPDF":true,"dontActivateAfterOpenMD":true,"highlightDuration":0.75,"noTextHighlightsInEmbed":false,"noAnnotationHighlightsInEmbed":true,"persistentTextHighlightsInEmbed":true,"persistentAnnotationHighlightsInEmbed":false,"highlightBacklinks":true,"selectionBacklinkVisualizeStyle":"highlight","dblclickEmbedToOpenLink":true,"highlightBacklinksPane":true,"highlightOnHoverBacklinkPane":true,"backlinkHoverColor":"","colors":{"Yellow":"#ffd000","Red":"#ea5252","Note":"#086ddd","Important":"#bb61e5"},"defaultColor":"","defaultColorPaletteItemIndex":0,"syncColorPaletteItem":true,"syncDefaultColorPaletteItem":false,"colorPaletteInToolbar":true,"noColorButtonInColorPalette":true,"colorPaletteInEmbedToolbar":false,"quietColorPaletteTooltip":false,"showStatusInToolbar":true,"highlightColorSpecifiedOnly":false,"doubleClickHighlightToOpenBacklink":true,"hoverHighlightAction":"preview","paneTypeForFirstMDLeaf":"right","singleMDLeafInSidebar":true,"alwaysUseSidebar":true,"ignoreExistingMarkdownTabIn":[],"defaultColorPaletteActionIndex":4,"syncColorPaletteAction":true,"syncDefaultColorPaletteAction":false,"proxyMDProperty":"PDF","hoverPDFLinkToOpen":false,"ignoreHeightParamInPopoverPreview":true,"filterBacklinksByPageDefault":true,"showBacklinkToPage":true,"enableHoverPDFInternalLink":true,"recordPDFInternalLinkHistory":true,"alwaysRecordHistory":true,"renderMarkdownInStickyNote":false,"enablePDFEdit":false,"author":"","writeHighlightToFileOpacity":0.2,"defaultWriteFileToggle":false,"syncWriteFileToggle":true,"syncDefaultWriteFileToggle":false,"enableAnnotationDeletion":true,"warnEveryAnnotationDelete":false,"warnBacklinkedAnnotationDelete":true,"enableAnnotationContentEdit":true,"enableEditEncryptedPDF":false,"pdfLinkColor":"#04a802","pdfLinkBorder":false,"replaceContextMenu":true,"showContextMenuOnMouseUpIf":"Mod","contextMenuConfig":[{"id":"action","visible":true},{"id":"selection","visible":true},{"id":"write-file","visible":true},{"id":"annotation","visible":true},{"id":"modify-annotation","visible":true},{"id":"link","visible":true},{"id":"text","visible":true},{"id":"search","visible":true},{"id":"speech","visible":true},{"id":"page","visible":true},{"id":"settings","visible":true}],"selectionProductMenuConfig":["color","copy-format","display"],"writeFileProductMenuConfig":["color","copy-format","display"],"annotationProductMenuConfig":["copy-format","display"],"updateColorPaletteStateFromContextMenu":true,"mobileCopyAction":"pdf-plus","showContextMenuOnTablet":false,"executeBuiltinCommandForOutline":true,"executeBuiltinCommandForZoom":true,"executeFontSizeAdjusterCommand":true,"closeSidebarWithShowCommandIfExist":true,"autoHidePDFSidebar":false,"defaultSidebarView":1,"outlineDrag":true,"outlineContextMenu":true,"outlineLinkDisplayTextFormat":"{{file.basename}}, {{text}}","outlineLinkCopyFormat":"{{linkWithDisplay}}","recordHistoryOnOutlineClick":true,"popoverPreviewOnOutlineHover":true,"thumbnailDrag":true,"thumbnailContextMenu":true,"thumbnailLinkDisplayTextFormat":"{{file.basename}}, p.{{pageLabel}}","thumbnailLinkCopyFormat":"{{linkWithDisplay}}","recordHistoryOnThumbnailClick":true,"popoverPreviewOnThumbnailHover":true,"annotationPopupDrag":true,"showAnnotationPopupOnHover":true,"useCallout":true,"calloutType":"PDF","calloutIcon":"highlighter","highlightBacklinksInEmbed":false,"highlightBacklinksInHoverPopover":false,"highlightBacklinksInCanvas":true,"clickPDFInternalLinkWithModifierKey":true,"clickOutlineItemWithModifierKey":true,"clickThumbnailWithModifierKey":true,"focusEditorAfterAutoPaste":true,"clearSelectionAfterAutoPaste":true,"respectCursorPositionWhenAutoPaste":true,"blankLineAboveAppendedContent":true,"autoCopy":false,"autoFocus":false,"autoPaste":false,"autoFocusTarget":"last-active-and-open-then-last-paste","autoPasteTarget":"last-active-and-open-then-last-paste","openAutoFocusTargetIfNotOpened":true,"howToOpenAutoFocusTargetIfNotOpened":"right","closeHoverEditorWhenLostFocus":true,"closeSidebarWhenLostFocus":false,"openAutoFocusTargetInEditingView":true,"executeCommandWhenTargetNotIdentified":true,"commandToExecuteWhenTargetNotIdentified":"switcher:open","autoPasteTargetDialogTimeoutSec":20,"autoCopyToggleRibbonIcon":true,"autoCopyIconName":"highlighter","autoFocusToggleRibbonIcon":true,"autoFocusIconName":"zap","autoPasteToggleRibbonIcon":true,"autoPasteIconName":"clipboard-paste","viewSyncFollowPageNumber":true,"viewSyncPageDebounceInterval":0.3,"openAfterExtractPages":true,"howToOpenExtractedPDF":"tab","warnEveryPageDelete":false,"warnBacklinkedPageDelete":true,"extractPageInPlace":false,"askExtractPageInPlace":true,"pageLabelUpdateWhenInsertPage":"keep","pageLabelUpdateWhenDeletePage":"keep","pageLabelUpdateWhenExtractPage":"keep","askPageLabelUpdateWhenInsertPage":true,"askPageLabelUpdateWhenDeletePage":true,"askPageLabelUpdateWhenExtractPage":true,"copyOutlineAsListFormat":"{{linkWithDisplay}}","copyOutlineAsListDisplayTextFormat":"{{text}}","copyOutlineAsHeadingsFormat":"{{text}}\n\n{{linkWithDisplay}}","copyOutlineAsHeadingsDisplayTextFormat":"p.{{pageLabel}}","copyOutlineAsHeadingsMinLevel":2,"newFileNameFormat":"","newFileTemplatePath":"","newPDFLocation":"current","newPDFFolderPath":"","rectEmbedStaticImage":false,"rectImageFormat":"file","rectImageExtension":"webp","zoomToFitRect":false,"rectFollowAdaptToTheme":true,"rectEmbedResolution":100,"includeColorWhenCopyingRectLink":true,"backlinkIconSize":50,"showBacklinkIconForSelection":false,"showBacklinkIconForAnnotation":false,"showBacklinkIconForOffset":true,"showBacklinkIconForRect":false,"showBoundingRectForBacklinkedAnnot":false,"hideReplyAnnotation":false,"hideStampAnnotation":false,"searchLinkHighlightAll":"true","searchLinkCaseSensitive":"true","searchLinkMatchDiacritics":"default","searchLinkEntireWord":"false","dontFitWidthWhenOpenPDFLink":true,"preserveCurrentLeftOffsetWhenOpenPDFLink":false,"defaultZoomValue":"page-width","scrollModeOnLoad":0,"spreadModeOnLoad":0,"usePageUpAndPageDown":true,"hoverableDropdownMenuInToolbar":true,"zoomLevelInputBoxInToolbar":true,"popoverPreviewOnExternalLinkHover":true,"actionOnCitationHover":"pdf-plus-bib-popover","anystylePath":"","enableBibInEmbed":false,"enableBibInHoverPopover":false,"enableBibInCanvas":true,"citationIdPatterns":"^cite.\n^bib\\d+$","copyAsSingleLine":true,"removeWhitespaceBetweenCJChars":true,"dummyFileFolderPath":"","externalURIPatterns":[".*\\.pdf$","https://arxiv.org/pdf/.*"],"modifierToDropExternalPDFToCreateDummy":["Shift"],"vim":false,"vimrcPath":"","vimVisualMotion":true,"vimScrollSize":40,"vimLargerScrollSizeWhenZoomIn":true,"vimContinuousScrollSpeed":1.2,"vimSmoothScroll":true,"vimHlsearch":true,"vimIncsearch":true,"enableVimInContextMenu":true,"enableVimOutlineMode":true,"vimSmoothOutlineMode":true,"vimHintChars":"hjklasdfgyuiopqwertnmzxcvb","vimHintArgs":"all","PATH":""},"styleSettings":null,"styleSheet":".pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight)[data-highlight-color=\"yellow\"],\n.pdf-embed[data-highlight-color=\"yellow\"] .textLayer .mod-focused {\n    --pdf-plus-color: #ffd000;\n    --pdf-plus-backlink-icon-color: #ffd000;\n    --pdf-plus-rect-color: #ffd000;\n}\n.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight)[data-highlight-color=\"red\"],\n.pdf-embed[data-highlight-color=\"red\"] .textLayer .mod-focused {\n    --pdf-plus-color: #ea5252;\n    --pdf-plus-backlink-icon-color: #ea5252;\n    --pdf-plus-rect-color: #ea5252;\n}\n.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight)[data-highlight-color=\"note\"],\n.pdf-embed[data-highlight-color=\"note\"] .textLayer .mod-focused {\n    --pdf-plus-color: #086ddd;\n    --pdf-plus-backlink-icon-color: #086ddd;\n    --pdf-plus-rect-color: #086ddd;\n}\n.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight)[data-highlight-color=\"important\"],\n.pdf-embed[data-highlight-color=\"important\"] .textLayer .mod-focused {\n    --pdf-plus-color: #bb61e5;\n    --pdf-plus-backlink-icon-color: #bb61e5;\n    --pdf-plus-rect-color: #bb61e5;\n}\n.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight) {\n    --pdf-plus-color: rgb(var(--text-highlight-bg-rgb));\n    --pdf-plus-backlink-icon-color: rgb(var(--text-highlight-bg-rgb));\n    --pdf-plus-rect-color: rgb(var(--text-highlight-bg-rgb));\n}\n.pdf-plus-backlink-highlight-layer .pdf-plus-backlink.hovered-highlight {\n\t--pdf-plus-color: green;\n\t--pdf-plus-backlink-icon-color: green;\n   --pdf-plus-rect-color: green;\n}\n.pdf-plus-color-palette-item[data-highlight-color=\"yellow\"] > .pdf-plus-color-palette-item-inner {\n    background-color: #ffd000;\n}\n.pdf-plus-color-palette-item[data-highlight-color=\"red\"] > .pdf-plus-color-palette-item-inner {\n    background-color: #ea5252;\n}\n.pdf-plus-color-palette-item[data-highlight-color=\"note\"] > .pdf-plus-color-palette-item-inner {\n    background-color: #086ddd;\n}\n.pdf-plus-color-palette-item[data-highlight-color=\"important\"] > .pdf-plus-color-palette-item-inner {\n    background-color: #bb61e5;\n}\n.pdf-plus-color-palette-item:not([data-highlight-color]) > .pdf-plus-color-palette-item-inner {\n    background-color: transparent;\n}\n.workspace-leaf.pdf-plus-link-opened.is-highlighted::before {\n\topacity: 0.5;\n}\nbody {\n    --pdf-plus-yellow-rgb: 255, 208, 0\n}\nbody {\n    --pdf-plus-red-rgb: 234, 82, 82\n}\nbody {\n    --pdf-plus-note-rgb: 8, 109, 221\n}\nbody {\n    --pdf-plus-important-rgb: 187, 97, 229\n}\nbody {\n    --pdf-plus-default-color-rgb: var(--text-highlight-bg-rgb)\n}\n.callout[data-callout=\"pdf\"][data-callout-metadata=\"yellow\"] {\n\t--callout-color: var(--pdf-plus-yellow-rgb);\n   background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))\n}\n.callout[data-callout=\"pdf\"][data-callout-metadata=\"red\"] {\n\t--callout-color: var(--pdf-plus-red-rgb);\n   background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))\n}\n.callout[data-callout=\"pdf\"][data-callout-metadata=\"note\"] {\n\t--callout-color: var(--pdf-plus-note-rgb);\n   background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))\n}\n.callout[data-callout=\"pdf\"][data-callout-metadata=\"important\"] {\n\t--callout-color: var(--pdf-plus-important-rgb);\n   background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))\n}\n.callout[data-callout=\"pdf\"] {\n\t--callout-color: var(--pdf-plus-default-color-rgb);\n   background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))\n}\n.callout[data-callout=\"pdf\"] {\n   --callout-icon: lucide-highlighter;\n}"}

Error messages (optional)

Happened when I ran the "Reload app without saving" command. Don't think it affected the bug
Image

@GnoxNahte GnoxNahte added the bug Something isn't working label Apr 13, 2025
@GnoxNahte
Copy link
Author

After submitting the issue and doing some more tests, I realised it might be an Obsidian bug?

Obsidian's own PDF viewer doesn't allow to skip pages if the user sets a custom zoom level (Even when setting it to the same zoom level as Fit width/height). But the plugin's fit page does the same thing as Fit width/height, just taking the minimum value? So as a user expect it to behave the same?

Anyway, I'm pretty sure its an Obsidian bug, might submit it to the forums when I'm free (or someone else can do it too, if they want). Just leaving the issue up to let you and other users know about it. Feel free to close the issue.

Thanks for making and maintaining the plugin, ありがとうございます!

@RyotaUshio
Copy link
Owner

RyotaUshio commented Apr 13, 2025

As you have noticed, this is how Obsidian's bulit-in PDF viewer works, and it's actually by design.
If you inspect the code running in Obsidian, you can clearly tell that the Obsidian team intended to disable page navigation by arrow keys when the zoom level is not "fit to width".

I don't really understand this decision though. That's why I made a PDF++ option that allows you to navigate using PageUp/PageDown keys (link: obsidian://pdf-plus?setting=usePageUpAndPageDown) regardless of the zoom level. It's enabled by default.

Thanks for making and maintaining the plugin, ありがとうございます!

@GnoxNahte
Copy link
Author

Ah I didn't notice that option, will use it in the future. Thanks for the quick reply!

@GnoxNahte
Copy link
Author

GnoxNahte commented Apr 13, 2025

Just a thought:

For future users, would you consider adding an option to override Obsidian’s default behavior? I imagine you could implement it pretty easily. Looking at your code, it seems like just adding the "ArrowDown" and "ArrowUp" keybindings in this section?

Of course, you are much more familiar with the codebase the docs than I am. Just thought I’d share the idea in case it’s helpful.

I also haven't looked at Obsidian's code or build and tested what I suggested so I'm not even sure if it'll work.

@RyotaUshio
Copy link
Owner

Yeah, but you wouldn't want that because you will not be able to use the arrow keys for scrolling.

@GnoxNahte
Copy link
Author

Oh I meant ArrowLeft and ArrowRight. Sorry was mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants