yermolim / ts-pdf

PDF.js-based PDF files viewer with annotation support
GNU Affero General Public License v3.0
63 stars 15 forks source link

Import to Obsidian plugin and usage ? #17

Open 1811htsang opened 4 months ago

1811htsang commented 4 months ago

Hi, i recently find out ur library for pdf feature, so at first i imported it successfully to code for obsidian plugin. However, i've encountered a problem about this

    containerSelector: "#your-html-container-selector", 
    workerSource: "", // path to the PDF.js worker script
    userName: "your_username",
    // you can check other properties using your editor hints
 };

i quite confused about the containerSelector and workerSource , which parameter of obsidian that i can fill it in, i've already installed pdfjs library for it

jacobdavis1 commented 2 days ago

Hello! I am not the developer, just someone who is using their good work.

Worker source is the actual worker file, eg a file path or a CDN (web-hosted js file): https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.worker.min.js

Container selector is the CSS selector to find the element that will become the host for the PDF Viewer. Set the ID property for the HTML element you want targeted and then set the containerSelector to "#the-id-you-chose" (# means it looks at IDs). Be aware that this library makes the targeted element a Shadow DOM host.

As for your use case with Obsidian, I am afraid I dont know much about that. If it has an HTML structure and a DOM, I dont see why it wouldnt work.