Getting Coordinates of Embedded PDF - javascript

I would like to embed a PDF in a webpage. When a user clicks on a certain coordinate within the embedded PDF, I would like to know what coordinate it corresponds to with respect to the PDF (and not the browser window). I will then plan on inserting text into the PDF server side so that a user can click on a portion of a PDF and add text to it through the webpage.
Does anybody know of any JS or other solutions to do this? I am using Django for the website.

Related

How do i convert all the data in my webpage to a pdf and download it on the browser?

My task requires me to click a button on the webpage and download the data as a pdf file. Simply printing the webpage wont do as there are certain tabs which are visible only upon selection.The data source is readily available on the pagenameVM.js. I tried using jsPDF but that works only for a certain div in the page.I need to write the all the required data into the pdf and then download it.
Is it possible?

Exporting HTML canvas from inside of Chrome extension

I'm writing a Chrome extension where a canvas is modified, and I want to have the option to save the canvas data as an image. Is there any way for me (using JavaScript) to save directly to the file system (ideal) or at least prompt the user with a download menu so they can save it themselves?
There seems to be no way to do this except for these ideas:
Online backend written in PHP or something
An iframe to show the online website which would have the canvas on it
Tell the user to right click and save the canvas image

javascript / html / other programming language in PDF file

Is it possible to embed code inside a PDF document ?
I'm interested in creating a PDF document with a dynamic image,
so once a user will open the PDF in a certain time he will get to see image 1 and on a different time he will get to see image 2
(both images source will be on the web and will require HTTP transfer).
Looks like it is possible but it does not seem trivial:
PDF with dynamic image

Download large PDF in javascript

I have a website which hosts large PDF documents, as well as some other file formats.
How can I open up a download-dialog box in javascript so that the user can save the document to their computer?
PDF always needs download (even for iframe / embed /object ) so do not use those as its then potential double overload on server, once to downlink and show then potentially a second time by the scripting (However if user selects the "save download as" button in viewer the download should be just once)
The answer is display a small image or icon to show the download content, then back that up with
<Img src="cover.png">
something like this:-
<a href="https://africau.edu/images/default/sample.pdf" download="A Sample.pdf"><img src="https://www.freeiconspng.com/uploads/download-pdf-icon-png-icon-29.png" width="128" height="128"><a><br>right click icon to chose download options
note clicking the icon may show a blank page based on browser security, that is normal, hence the suggestion the user uses their discretion.

Trigger click on embedded PDF

I have a PDF embedded in a web page using the following code:
<object id="pdfviewer" data='test_full.pdf#page=1&toolbar=0&statusbar=0&messages=0&navpanes=0'
type='application/pdf'
width='500px'
height='350px'>
The PDF itself is set to open in full screen mode which shows no controls. The user can advance the slides by clicking on the view.
What I'd like to have is some way to trigger that click so that I can advance 2 similar PDF:s side-by-side (one for the actual slideshow and one for the speaker notes). Is this possible to do in javascript and/or jQuery? I have tried using the click()-method but it doesn't get through to the embedded PDF.
Update: Can't find any info on it, so I guess I'm out of luck and have to try a workaround. Am currently juggling 3 embeds of the same pdf (current page, next page and previous page), hiding and showing them and loading more pages as the user clicks around.
I doubt it. Allowing web page scripts to pass input events to the PDF viewer could be a security risk (since the viewer generally has access to system file dialogues via things like Save As).

Categories