logseq icon indicating copy to clipboard operation
logseq copied to clipboard

fix(pdf): incorrect filename encoding

Open doppioadamo opened this issue 2 years ago • 4 comments

When loading a document, the pdf.js library parses the URL for specific parameters (for example, #page=2&zoom=200). Therefore, in order to open a PDF file with the name file#1.pdf, the URL should look like file:///home/user/documents/file%231.pdf or file:///home/user/documents/file%231.pdf#page=2&zoom=200.

I found some related information in their repository: https://github.com/mozilla/pdf.js/wiki/Viewer-options

fixes #4401 fixes #4859 fixes #8533

doppioadamo avatar Mar 17 '23 13:03 doppioadamo

Related #8792, I'll QA this when it gets merged.

andelf avatar Mar 17 '23 14:03 andelf

This should be a feature request to add support for viewer options for PDF links.

Currently, the #fragment part is treated as part of a filename. So this fix will introduce more mess to PDF handling(trying to add a buggy path handing to a buggy assets url handing, in order to pass #fragment URL to pdf.js)

@xyhp915

I find that even using a file:// link, (:file-path (:block/properties page)) is saved without file://. No clue where the actual code is.

andelf avatar Mar 31 '23 02:03 andelf

PDF view-options like #page=2&zoom=200 should not be used in PDF assets links. Logseq tracks current PDF page numbering using its own property. Better use the highlight tools to link to any desired page.

andelf avatar Mar 31 '23 02:03 andelf

Mark this as hold, as fragment URL support is not planned for PDF view. CC @xyhp915

andelf avatar Apr 13 '23 09:04 andelf