Dynamically changing language of pdf viewer
See original GitHub issueI wanted to configure chunk size on pdf.js so instead of opening pdfs with the link i’m opening them when the iframe of the viewer is initialized with the open function from viewer.js:
open: function open(file, args) {...
$(element)[0].contentWindow.PDFViewerApplication.open(viewerUrl(), { rangeChunkSize: chunkSize() });
This works fine, but the problem is that i don’t know how to set the local language dynamically. I managed to do it with the function setLanguage ($(element)[0].contentWindow.document.webL10n.setLanguage("sl-SI");
), but this changes only 1 part (see the picture)
Is there a better way to do it ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Localization: Change Languages in JavaScript PDF Viewer
Localization: Updating Languages in Our JavaScript PDF Viewer · Chinese Simplified / Chinese Traditional (zh-Hans/zh-Hant) · Croatian (hr) · Czech (cs) · Danish...
Read more >Static and Dynamic Viewers | Transit Training
In the PDF viewer/Word preview a static viewer can be combined with a dynamic preview: Source language: If a PDF file of the...
Read more >How to dynamically change the "src" or "data" for a PDF Object ...
I'm hoping the instance of Adobe Acrobat Reader will stay on the screen, but the new document will load into it. Here is...
Read more >Create dynamic PDF documents in Adobe InDesign
Create interactive PDF documents with buttons, movies and sound clips, hyperlinks, bookmarks, and page transitions in InDesign.
Read more >Dynamically displaying PDF in a region - Oracle Communities
The goal is to have a region on the same page, which displays the currently selected pdf using the browsers PDF viewer (this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
viewer.html link add locale query parameter , pdf/web/viewer.html?locale=${langCode}&file= then in viewer.js add two lines in class GenericL10n constructor class GenericL10n { constructor(lang) { const urlParams = new URLSearchParams(window.location.search); lang = urlParams.get(‘locale’); this._lang = lang;
it works for me.
You should rather patch it this way, change the initialization in
_initializeL10n
or as a patch