Giter VIP home page Giter VIP logo

obsidian-better-pdf-plugin's Introduction

Obsidian Better PDF Plugin

Goal of this Plugin in to implement a native PDF handling workflow in Obsidian

Features

  • Insert a single PDF Page inside Note
  • Insert a list or range of pages into Obsidian Note
  • Hyperlink to PDF
  • Scale the size of PDF Pages to fit Note layout
  • Rotate PDF
  • Cutout PDF Parts

Demo

Sample

Syntax

parameter required example
url yes myPDF.pdf or subfolder/myPDF.pdf or "[[MyFile.pdf]]"
link optional (default = false) true or false
page optional (default = 1) 1 or [1, [3, 6], 8] where [3, 6] is an inclusive range of pages. page = 0 is an alias for the whole document
range optional [1, 3] Insert pages 1 to 3 (inclusive). Overwrites page.
scale optional (default = 1.0) 0.5 for 50% size or 2.0 for 200% size
fit optional (default = true) true or false
rotation optional (default = 0) 90 for 90deg or -90 -90deg or 180
rect optional (default = [0,0,0,0]) offsetX, offsetY, sizeY, sizeX in Pixel

Integration

obsidian-better-pdf-plugin's People

Contributors

batman-nair avatar lishid avatar luleyleo avatar mprojectscode avatar mszturc avatar skyec0re avatar wxxedu avatar your-sudden-death avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

obsidian-better-pdf-plugin's Issues

Fuzziness in words arrangements

This is the view if the slide from the obsidian pdf viewer :

image

and this is what the plugin renders:
image

I changed the font in the pdf, font changes but fuzziness still exist.
Does it have a workaround?

Integrate a parameter to force ranges to display below each other

Hello,

right now, if one includes a range, e.g.

```pdf
{
	"url" : "Subjects/BE25 Industrial Biotechnology/assets/BE25 Summary.pdf",
	"scale" : 1,
	"range" : [17,19],
	"fit" : false,
	"rotation" : 90
	
}
    ```

the following image will be present:
Content hidden

I hid the contents because I am not free to share it, but the top left is slides 17, top right is slide 18, and slide 19 then moves down to the next "row". This usually seems to behave in rows of three (at least it does so on my system).

Now, the pseudo-fix is to use "fit": true, but that increases image size to the point where the quality suffers.

The better solution would be to integrate a switch to force each slide on a new line visually when embedded, instead of appending to the side.

Would this be possible?

Thank you,

Sincerely,
~Gw

Removing preview on hover

Hello,

I love the plugin, very useful and clean. Is there any way to remove the preview on hover? When adding multiple pdf files on the same note, it become very annoying when scrolling down and getting the previews pop up one by one for each file. I've googled around to find any way to stop this with no luck.

Is there any solution to this?

Thank you!

possible undocumented limitation in number of distinct ranges permissible

The following specification generates an "Error: Invalid page request" following page 26:

{
"url": "/assets/pdfs/dek-neo4j-graph-data-modeling.pdf",
"page": [ [7, 8], 13, [25, 26], [34, 36], [75, 79]]
}

However this one does not:

{
"url": "/assets/pdfs/dek-neo4j-graph-data-modeling.pdf",
"page": [ [34, 36], [75, 79]]
}

New plugin name requirements

Hi @MSzturc

Per our developer policies,
please ensure that your plugin's name does not include the word "Obsidian".
In addition, the plugin name should not include the word "Plugin", as that is unecessary duplication.
We have already modified the name of your plugin to "Better PDF" in our records.

To maintain compliance, take the following actions:

  1. Modify the manifest.json file in your plugin repository.
  2. Generate a new release for your plugin to ensure users download the updated manifest.

If you have a idea for a different plugin name, you may also submit a pull request to the obsidianmd/obsidian-releases repository.

Thank you for your cooperation.
— the Obsidian team

Plugin is not functional

Version 1.4.0
Obsidian v.1.3.3

Plugin is disabled by Obsidian, with attempt to activate it I get the message "Better PDF plugin is no longer functional. We recommend unistallling it".

A lot of my notes use your plugin. Is it possible to fix it? or we've lost the plugin forever

Error with several embeds on one page

It seems there are some problems with rendering

plugin:better-pdf-plugin:1788 Uncaught (in promise) Error: Invalid canvas size
    at DOMCanvasFactory.create (plugin:better-pdf-plugin:1788:13)
    at CachedCanvases.getCanvas (plugin:better-pdf-plugin:5252:40)
    at CanvasGraphics.beginDrawing (plugin:better-pdf-plugin:5959:53)
    at InternalRenderTask.initializeGraphics (plugin:better-pdf-plugin:4277:14)
    at eval (plugin:better-pdf-plugin:2734:26)

Whey you have several blocks pointing to the same pdf file on one page

Add option to import whole PDF

For inserting whole pdf's it would be neat to have the possibility to add a whole pdf.
Maybe make this the default instead of 1 #page.
Since I'm new to contributing on GitHub I pasted the code below, which I would add on Line 37 in main.ts:

// page parameter as trigger for whole pdf, 0 = all pages
if (parameters.page === 0){
    var pagesArray = [];
    for(var i = 1;i <= pdfjs.getDocument(buffer).numPages; i++){
      pagesArray.push(i);
    }
    parameters.page = pagesArray;
}

Option to stop hover-over to open pdf-preview

Hi,

this is an extremely useful plugin, but one thing is kinda detrimental. Obsidian-markdown-files don't necessarily lend themselves to export well because you loose some core functionality such as tag-searches. Hence, most stuff I write in obsidian I also read in it.

For that, this plugin is a real time-saver over using screen-captures and embedding them as images. However, if I want to embed pages 27-32, I specifically don't want to open the preview of the entire file whenever I hover over the resulting images in obsidian. Otherwhise, I would just embed the file in its entirety.

As it doesn't seem to be an option right now, would it be possible to include an option to block that behaviour, a simple boolean flag?

Thank you,
Sincerely,
~Gw

Pdf pages not rendering unless block is edited

In the latest Obsidian versions, pdf pages usually aren't rendered.
This generally occurs when in your vault there are a lot of pdf blocks or if a single documents frequently use single pdf page blocks. You can actually manage to display a block, pressing the "edit block" icon that obsidian offers to any kind of block, but it is very tedious to do it every time you jump in a new document.

Bug and workaround:

  1. Bug occurs

2. Block exists, but is not rendered

3. Try editing it

4. Stop editing. It directly appears on preview mode (note that this document is freely accessible from the book website)

STEPS TO REPRODUCE:

  1. Use a big pdf file with a lot of pages (about 100) and use a bunch of them in a document:

This is page 1

{
	"url": "file.pdf" ,
	"page": 1
}

This is page 2

{
	"url": "file.pdf" ,
	"page": 2
}

...
This is page 40

{
	"url": "file.pdf" ,
	"page": 40
}
  1. If this bug is not yet reproduced create a new document and repeat step 1. Occasionally it can occur by closing all the new documents in the editor and opening them one by one.

I tested this using the latest plugin version (1.4.0) and Obsidian v1.1.16.
I tried removing every community plugin except better-pdf, but nothing changed.
The problem occurs in every platform I could try (Linux, Windows 10, Android).

Scale parameter issue

"Scale" parameter do not scale but only resample image and stretch it on all screen width.

PDF page not rendering

image
I have written the code correctly but the PDF page isn't rendering in reading view. Anyone can help please! Much appreciated!

Error in the ReadMe

For the rect attribute, there is an error in the instructions:
image

  1. sizeX, sizeX repeated.
  2. And on trial, I realised offsetX is along horizontal, while for sizeX it is along the vertical.

can you confirm what is the exact instruction?
@MSzturc

Option for having a range of pages.

It would be really helpful if there could be a way to include a range of pages instead of listing them with commas. Something like [21-48]. If there is an option already present, I couldn't find it mentioned.

Please help out :)

undocumented quirks in page range specification

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.

option for displaying pdfs in different locations

it would be nice to link pdfs that are not inside the vault but somewhere else on the filesystem. when I try to do that I get an error showing the url where the plugin tried to find the file and it shows the location of my attachments plus the url I told it to look up.
it would be great if I cloud flag the url as "external" or something like that...

Unknown Error Exception

Not sure when this started happening but my previously working PDFs now show this.
UnknownErrorException: The API version "2.12.313" does not match the Worker version "2.5.207".

Topics missing

This repository doesn't have obsidian-md/obsidian topics set, so it's harder to find it on GitHub.

can we use screenshot

it's hard to get the localtion of pages where we actually want, can we use screenshot direatly? thx

Adding UI

This plugin is awesome.
I need to add pdf pages quickly and need some graphical way to do this.
Writing the json into the code block is just way too slow.
Having some sort of pop up that can be activated via a shortcut or via ctrl + p can speed up the process of inserting a page into the current document.
The pop-up should function similar to the pop-up used in the obsidian tasks plugin. => https://github.com/schemar/obsidian-tasks
It should allow new insertions to be made, and it should allow existing insertions to be modified.

Critical Crashing Vault

Hello,
thanks for these plugin but I have an Issue. If I type in the picture mentioned notation, the vault is crashing and can't be open until I delete these in another editor. But more critical is that these crashing damages the file.
Screenshot 2023-04-26 093904

Poor visual quality on embeded display, regardless of scale setting

i am seeing poor visual quality on embeded display of PDFs, regardless of scale setting.
I have the same PDF diplayed by this plugin, inline, and by the built in Obsidian option.
The built in option is crystal clear, where this plugins embedded display looks like a 320X240 image zoomed in.
Changing scaling option does change the display, but it never looks 'good'

Thank you

Enable to select text in pdf?

My understanding is that the pdf are inserted as pictures, and we lose the ability to select the content.

Would it be possible to have the pdf rendered with the ability to select the content? Something along the line of OCR or just another type of formatting?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.