Skip to main content
Participant
September 6, 2022
Question

"Focus on PDF rendering" Not Working (+ throwing server error)

  • September 6, 2022
  • 1 reply
  • 1068 views

Hello everyone!  I'm trying to REMOVE focus from my pdf viewer on render. 

I thought it would be a simple line of code "focusOnRendering: false"... but that has not seemed to work.  The code below re-renders the pdf when an object that contains a pdf <name> and <URL> is clicked.  I would appreciate the help! 🙏

 

<script type="text/javascript">

function renderPdf(fileName, url) {
var adobeDCView = new AdobeDC.View({ clientId: "<id>", divId: "adobe-dc-view" });
adobeDCView.previewFile({
content: { location: { url }},
metaData: { fileName }
}, {embedMode: "FULL_WINDOW",
defaultViewMode: "FIT_WIDTH",
focusOnRendering: false,
enableSearchAPIs: false,
showZoomControl: false,
enableLinearization: true,
enableSearchAPIs: false,
showBookmarks: false,
});

}

$('.piecenamecontainer').on('click', function () {renderPdf($(this).find('.piecename').text(), $(this).find('.pdf').text()) });
document.addEventListener("adobe_dc_view_sdk.ready", function () { renderPdf("{<name>}", "{<PDF_URL>}") });
 
</script>
    This topic has been closed for replies.

    1 reply

    Raymond Camden
    Community Manager
    Community Manager
    September 6, 2022

    So... a few things. You can calling renderPDF when our library launches, _and_ you are calling it on click, is that what you meant to do? 

     

    Secondly, are you 100% sure removing focusOnRendering makes the code work fine?

     

    Can you share a public URL where I could see this?

    Participant
    September 8, 2022

    Hello Raymond, sorry for the late reply.  Yes, I am trying to render the pdf on click.  

    The code to render the pdf is working just fine.  The argument to 'remove focus' is all that's not working. 

    I'm quite new to development, but I'm trying to make a digital sheet music repertoire.

    Here ya go: https://www.clairmusic.com/spaces/rousseau-classical

     

    I'm trying to do this to add keyboard shortcuts.  Yet, it renders the pdf, keyboard shortcuts are just active for the pdf rather than the site.