When I run the code below in console from the ‘top’ of the page, it has it’s intended effect: The embedded PDF viewer pdf.js zooms in.
This is being accomplished by an event listener in viewer.html waiting to hear “zoomIn” It then executes the api command for the viewer to zoom in.
Problem is, when I try to replicate this behavior using st.components nothing happens. Only alert1 fires, so for whatever reason the rest of the code seems to not be going off. Any idea what I’m doing wrong?
Did anyone find a solution to this? i got the exact same error trying to post from child iframe to parent window… Alerts and console.logs before the postMessage are executed, but the postMessage never appears in the parent window…
Hi guys,
I never actually found a solution to this. I was just using the ‘zoom in’ as a way to test the functionality of passing commands to PDF.JS and my real goal was to pass a string to search within the document.
I eventually ended up accomplishing passing the search string to the document on the end of the URL for where the PDF.JS is hosted which is in AWS. I think you can pass zoom in commands and such through the URL too. Happy to hop on the phone and discuss any of this with anyone, just send me a DM and we can chat.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.