obsidian-better-pdf-plugin icon indicating copy to clipboard operation
obsidian-better-pdf-plugin copied to clipboard

undocumented quirks in page range specification

Open TSSlade opened this issue 2 years ago • 1 comments

The following declaration will fail with the specified errors:

{"url": "/assets/pdfs/dek-neo4j-graph-data-modeling.pdf", "page": [[7, 8], 13]}
# PDF Parameters invalid: Unterminated string in JSON at position 80
{"url": "/assets/pdfs/dek-neo4j-graph-data-modeling.pdf", "page": [,[7, 8], 13]}
# PDF Parameters invalid: Unexpected token ',', ..." "page": [,[7, 8], 1"... is not valid JSON

However this one will work: {"url": "/assets/pdfs/dek-neo4j-graph-data-modeling.pdf", "page": [ [7, 8], 13]}

The example of proper syntax for a multiple-page range gives [1, [3, 6], 8] but does not specify that the initial entry must be a single page rather than a range of pages.

TSSlade avatar Feb 20 '23 17:02 TSSlade

Faced the same problem and found the issue in code. It is not related to starting with a single page or not.

The issue is double square brackets ("[[" and "]]") are sort of skipped in the JSON parsing as it is used for Obsidian linking. The solution is to add a space in between the double square brackets.

Documenting the behavior or fixing it would be beneficial.

batman-nair avatar Feb 28 '23 01:02 batman-nair