# Embedding unscrollable PDF pages

**URL:** <https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617>\
**Category:** Help\
**Tags:** pdf-viewer\
**Created:** [October 18, 2023, 8:13am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617 "2023-10-18T08:13:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tnyjstr](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/b5e925/32.png) [@tnyjstr](https://forum.obsidian.md/u/tnyjstr)\
**Post date:** [October 18, 2023, 8:13am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/1 "2023-10-18T08:13:10Z")

</div>

Hello everyone,  
I am having a hard time working with embedded single PDF pages.  
I have a note with multiple PDF embeds of the same file, each showing a different page of the document through internal linking ( ![[(file).pdf#page=(number)] )

### What I’m trying to do

But I find it very tedious that scrolling through the note occasionally also scrolls through the respective PDFs when the cursor is on top of it while scrolling. I would like to have the pages sit statically inside of the note, without being able to scroll it - or at least avoid the scrolling while the cursor is hovering over the embed.

Is there a way around this?

I have tried to search for fitting CSS snippets, but I was not able to find any.  
There appears to be a solution [in another tool](https://blazor.syncfusion.com/documentation/pdfviewer/how-to/prevent-scrolling#:~:text=By%20setting%20the%20overflow%20property,the%20content%20of%20a%20PDF.) by somehow limiting overflow. But I am not proficient in CSS at all which heavily limits my understanding of how this would be applicable for Obsidian.

Any help or pointer is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![cheezopath](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cheezopath/32/33683_2.png) [@cheezopath](https://forum.obsidian.md/u/cheezopath)\
**Post date:** [October 18, 2023, 12:43pm UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/2 "2023-10-18T12:43:49Z")

</div>

I would love this too, would be super useful for TTRPG books and other reference without having to screenshot and crop and manage more assets to have the same effect.

---

<div class="post-metadata">

**Author:** ![ush](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/u/8e7dd6/32.png) [@ush](https://forum.obsidian.md/u/ush)\
**Post date:** [October 18, 2023, 2:42pm UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/3 "2023-10-18T14:42:32Z")

</div>

This CSS snippet will do.

```css
/* Hide alt text of PDF embed */
.internal-embed.pdf-embed::before {
    display: none;
}

/* ![[filename.pdf|fix]] will block pointer events */
.internal-embed.pdf-embed[alt="fix"] .pdf-container {
    pointer-events: none;
}

```

With this snippet enabled, any PDF embed of the form `![[...|fix]]` will be unscrollable.

## Options

1. If you want to make all PDF embeds with `#page=...` unscrollable, replace `[alt="fix"]` with `[src*="#page="]`.

2. To hide the toolbar at the top, add this:

3. Also, you can change `fix` to any string you like. For example, if you like `![[filename.pdf|unscrollable]]`, use this instead:

4. You can make ALL pdf embeds unscrollable by

## Limitation

This approach blocks all pointer events, not just scrolling. So other actions like selecting text, right-clicking to get the link to the selection, … won’t work.  
If someone knows a better solution, I would love to learn it so please let me know

## Update 2024

My plugin PDF++ supports this as one of its options.

---

<div class="post-metadata">

**Author:** ![tnyjstr](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/b5e925/32.png) [@tnyjstr](https://forum.obsidian.md/u/tnyjstr)\
**Post date:** [October 19, 2023, 6:48am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/4 "2023-10-19T06:48:12Z")

</div>

Thank you! This works like a charm.  
I also appreciate the in-depth instructions you provided!

---

<div class="post-metadata">

**Author:** ![tnyjstr](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/b5e925/32.png) [@tnyjstr](https://forum.obsidian.md/u/tnyjstr)\
**Post date:** [October 19, 2023, 9:00am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/5 "2023-10-19T09:00:11Z")

</div>

I have a little follow-up:

Are you aware of a method to fit the embedded page to a height that has been set in markdown?

I know there’s a (Fit Height) function for it via the toolbar - but since the toolbar is (thankfully) neither visible nor accessible now, I was wondering if there was a method to force this continually.

---

<div class="post-metadata">

**Author:** ![cheezopath](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cheezopath/32/33683_2.png) [@cheezopath](https://forum.obsidian.md/u/cheezopath)\
**Post date:** [October 19, 2023, 9:25am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/6 "2023-10-19T09:25:49Z")

</div>

[[filename.pdf#page=1&height=600]] would start on page 1 and fix the height at 600.

later I’ll have a go at implementing the above solution and see if I can get non-scrolling and fixed height working together.

---

<div class="post-metadata">

**Author:** ![tnyjstr](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/t/b5e925/32.png) [@tnyjstr](https://forum.obsidian.md/u/tnyjstr)\
**Post date:** [October 25, 2023, 8:53am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/7 "2023-10-25T08:53:11Z")

</div>

That would be absolutely amazing.

---

<div class="post-metadata">

**Author:** ![cheezopath](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cheezopath/32/33683_2.png) [@cheezopath](https://forum.obsidian.md/u/cheezopath)\
**Post date:** [October 25, 2023, 9:32am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/8 "2023-10-25T09:32:49Z")

</div>

turns out it really is as simple as:

```auto
[[filename.pdf#page=1&height=600|fix]]

```

to get a 600 pixel tall embed of pdf page 1 if you’re using ush’s handy snippet!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [November 1, 2023, 9:33am UTC](https://forum.obsidian.md/t/embedding-unscrollable-pdf-pages/69617/9 "2023-11-01T09:33:09Z")

</div>

Closed on November 1, 2023, 9:33am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
