Hi, @tobiasnolimitation!
Thanks for contacting us.
This is a requested feature and will definitely be in future updates 🙂
Thanks for sharing it, and have a good one!
Thank you for this.
For anyone else looking for a solution to this, here is how I solved it with JavaScript.
//Change the default zoom on the PDF Viewer
//Loop through all the PDF Embedder iframes
let pdfIframes = document.querySelectorAll(".pdfembed-iframe");
pdfIframes.forEach(iframe => {
iframe.addEventListener('load', () => {
//Pdf viewer class
let pdfViewer = iframe.contentWindow.PDFViewerApplication; //Events in EventBus and everything else can be found by console.log(pdfViewer)
//When the PDF is loaded, change the scale
pdfViewer.eventBus._on("pagesloaded", () => {
changeScaleInPdfViewer(iframe, "auto");
});
});
});
function changeScaleInPdfViewer(iframe, scale) {
//Change the value of the select
iframe.contentWindow.document.querySelector("#wppdf-iframe-body #scaleSelect").value = "auto";
setTimeout(() => { //Await for the select to change
//Dispatch the event in the PDF Viewer Application class
iframe.contentWindow.PDFViewerApplication.eventBus.dispatch('scalechanged', {'value': 'auto'});
}, 10)
}