# Default scroll position of newly loaded & zoomed PDF?

**URL:** <https://pdfjs.community/t/default-scroll-position-of-newly-loaded-zoomed-pdf/1288>\
**Category:** Technical Support\
**Created:** [January 10, 2022, 11:09am UTC](https://pdfjs.community/t/default-scroll-position-of-newly-loaded-zoomed-pdf/1288 "2022-01-10T11:09:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user58](https://avatars.discourse-cdn.com/v4/letter/u/a5b964/32.png) [@user58](https://pdfjs.community/u/user58)\
**Post date:** [January 10, 2022, 11:09am UTC](https://pdfjs.community/t/default-scroll-position-of-newly-loaded-zoomed-pdf/1288/1 "2022-01-10T11:09:37Z")

</div>

Hello!

Using PDF.js Express Viewer, I need the opened PDF-s be zoomed in at a **certain area** of the first page. Can it be done?

I figured out how a newly loaded document appears zoomed. But I cannot figure out how to scroll to a certain part of the page.

(Short explanation: we display old newspaper pages, but users are only interested in certain articles on the pages.)

My code:

```javascript
<script>
  WebViewer({
    path: 'PDF/lib', 
    licenseKey: 'xxxxxxxxxxxxxxx',
    disabledElements: [
    'leftPanelButton','searchPanel','selectToolButton','searchButton','viewControlsButton','marqueeToolButton','themeChangeButton','contextMenuPopup'
    ],
    initialDoc: 'mypdf.pdf',
    // initialDoc: '/path/to/my/file.pdf', // You can also use documents on your server
  }, document.getElementById('viewer'))
  .then(instance => {
    // now you can access APIs through the WebViewer instance
    const { Core, UI } = instance;
    instance.UI.setLanguage('hu');

    // adding an event listener for when a document is loaded
    Core.documentViewer.addEventListener('documentLoaded', () => {
      console.log('document loaded');
      instance.setZoomLevel(<% =Left(myzoomlevel, 1) & "." & Right(myzoomlevel, 2) %>);
    })
  });
</script>

```

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [January 10, 2022, 11:09am UTC](https://pdfjs.community/t/default-scroll-position-of-newly-loaded-zoomed-pdf/1288/3 "2022-01-10T11:09:41Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [APIs for customizing UI](https://pdfjs.express/documentation/ui-customization/api.8)
- [PDF.js Express Viewer APIs](https://pdfjs.express/documentation/viewer/api)
- [PDF.js Express Viewer](https://pdfjs.express/documentation/viewer/overview)

APIs:
- [Core.DocumentViewer - displayFirstPage()](https://pdfjs.express/api/Core.DocumentViewer.html#displayFirstPage__anchor)
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [ExpressUtils(optionsopt) - # async extract() → {Promise.}](https://pdfjs.express/api/utils/ExpressUtils.html#extract__anchor)

Forums:
- [PDF.js Express Viewer not working via reverse proxies](https://pdfjs.community/t/pdf-js-express-viewer-not-working-via-reverse-proxies/1255/1)
- [Need support for customizations in webviewer for distance tool](https://pdfjs.community/t/need-support-for-customizations-in-webviewer-for-distance-tool/330/2)
- [Can I remove watermark from PDF.js viewer (free version)?](https://pdfjs.community/t/can-i-remove-watermark-from-pdf-js-viewer-free-version/1166/1)

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [January 13, 2022, 3:32pm UTC](https://pdfjs.community/t/default-scroll-position-of-newly-loaded-zoomed-pdf/1288/4 "2022-01-13T15:32:52Z")

</div>

Hey!

What you are looking for is the [`zoomTo`](https://pdfjs.express/api/Core.DocumentViewer.html#zoomTo__anchor) API - it lets you set the zoom level as well as the scroll position.

For example `instance.Core.documentViewer.zoomTo(4, 60, 30)` would zoom to 400% and scroll to 60,30.

Thanks,  
Logan
