You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've similar problems and need describes here #11359.
The default reload behavior of the pdf.js viewer is indeed to preserve the scroll position (and some other GUI states) if the file is exactly the same.
The scroll position is keep only if the document ID embedded in a PDF file is the same, even if the PDF is strictly the same (except ID).
So, i looking for a workaround about this PDF ID and try to keep the last position view for ALL PDF.
Is it possible to overwrite the default reload behavior of the pdf.js viewer to keep the last position view regardless IDs of PDFs?
Goal is to have a unique and global "viewOnLoad" to reuse the last position for all PDFs.
Thanks
The text was updated successfully, but these errors were encountered:
I finally found a way to preserve a unique scroll and zoom position for all PDF, i describe the solution here in case some else needs this:
In pdf.worker.js, need to modify the fingerprint key and hash value.
Search lines below: key: "fingerprint", get: function get() {
The line above should be: var hash;
define a fix value hash md5 var, i.e.: var hash = '826ad6b0338304c40b42644b5144f80a';
Then comment lines above.
This part retrieve the ID of the PDF, in my case I would ignore this part. //var idArray = 'this.xref.trailer.get('ID')'; // if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) { // hash = (0, _util.stringToBytes)(idArray[0]); // } else { // hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); // }
After these modification, you can add manually (dev mode) this extension to Chrome and keep the same position for all PDF.
I've similar problems and need describes here #11359.
The default reload behavior of the pdf.js viewer is indeed to preserve the scroll position (and some other GUI states) if the file is exactly the same.
The scroll position is keep only if the document ID embedded in a PDF file is the same, even if the PDF is strictly the same (except ID).
So, i looking for a workaround about this PDF ID and try to keep the last position view for ALL PDF.
Is it possible to overwrite the default reload behavior of the pdf.js viewer to keep the last position view regardless IDs of PDFs?
Goal is to have a unique and global "viewOnLoad" to reuse the last position for all PDFs.
Thanks
The text was updated successfully, but these errors were encountered: