how to embed a pdf from a url using pdf.js - javascript

I've googled alot but I can't find an answer to this simple question, I just want to do something like
embed_using_pdf.js url="http://freeexampapers.com/index.php/directory/download?location=A%20Level/Accounting/Edexcel/2006%20Jan/9944774_Question%20Paper.pdf"
and I get a pdf inside my page
btw, this is a force download link, that's why I don't want to use an iframe or an object.

Related

How to make file/result downloadable in html

I will request you see this repo: https://github.com/imsikka/ArtGallery
I want to make the result downloadable using a download button, I know how to make a download button but I don't know how it will make the file downloadable, I need to link the button with a specific part code or what?
Well I really don't know how to do it i surfed the net but got nothin really helpful
You can upload the information you want to download on an uploader site and apply the download link to the button using
Maybe this way you can solve your problem
Info: Conclusion. In HTML, a button link to another page can be by using the tag, tag, and the tag. A link on a button is get by href=”” attribute of tag. The “type=button” and “onclick=link” attributes are used to create a link on the button.

Download a file using python from a webpage without opening the webpage

I was looking for a way to write a script that will download a file from a specific website but without opening the website itself. I want everything to happen in the background.
The website is morningstar and a specific link for the example is this one:
https://financials.morningstar.com/ratios/r.html?t=MSFT
in this page, there is a "Button" (it is not really declared as a button but as a Hyperlink, the <a> tag in HTML)
I added a photo in the bottom so you can see for yourself exactly the way they wrote the code.
Anyway, I saw that when I clicked the button the href attribute actually calls a javascript function which then creates the links from which the file will be downloaded.
I am looking for a way that I can write a script and give it the link I want, for example, the link above, and the script will download this specific CSV file from that page into a folder of my choice.
I was looking at some selenium tutorials but I couldn't find much help for my specific problem.
Here's an example I use:
import requests
url = 'http://via.placeholder.com/350x150'
dashboardFile = requests.get(url, allow_redirects=True)
open('d:/dev/projects/new-wave/dashboard.pdf', 'wb').write(dashboardFile .content)
Oh, and depending on the size of the file you would want to download in chunks. A quick search of: "python download large file in chunks" will help.

Export current rendered view/template as a PDF with Nativescript-VueJS

Using NativeScript + VueJS, I'm trying to find a way to take a dynamic template that's rendered based on props and route data, and tap a button to save the "view" as a PDF to the filesystem.
I found this tutorial here which gives me a start: https://medium.com/#kumarandena/pdf-generation-in-nativescript-using-javascript-libraries-864ecf4e9a3a
This generates a Base64 which you then copy to clipboard and open in a browser. In iOS for example if I choose to save the page as a file it's just unknown.pdf. So my goal is to reference an html element, like a div, and save all the contents exactly as they appear into a folder of my choice in the native file system.
There's little to find on this so wondering if someone has accomplished this.
I use domtoimage to convert any dom element to an image, and it works well. Then you can probably insert that image to a pdf using jsPDF or pdfMake.
I see in the pdfMake playground that you can insert an image with a dataurl format.

Need to scroll to a specific line in a PDF embedded in html page

I am looking for a solution where in I am able to move to a specific line in a pdf embedded in HTML .
At the moment I am using object tag to display the pdf in html page .
I know by using open parameters I can scroll through a pdf to a specific page but I am unsure how can this be achieved for a particular line navigation .
Open parameters example has been shared in the below mentioned question link but I need some parameter which helps me reach a particular line in PDF may be using some co-ordinates if that's achievable.The requirement is to scroll a PDF to a particular line and only the PDF should get scrolled not the original HTML page.
How to move the scroll bar of the browser on a pdf file with ASP / Javascript?
I can use any of the JQuery PDF viewers as mentioned here :
http://www.jqueryrain.com/2012/09/best-jquery-pdf-viewer-plugin-examples/
in case your solution uses them .
Please note I don't want to move to a particular location in an HTML page as mentioned in below post rather its about navigating to a particular line in a PDF embedded in a page.
How can I scroll to a specific location on the page using jquery?
Any help or leads would be really appreciated .
Thanks in advance.
Create a destination in the PDF file (assuming you are the one generating it) at the appropriate line, and add #destination to the end of the URL
See https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html#OpenaPDFfiletoasetdestination for an explanation on linking to PDF page numbers and destinations.
Assuming you don't have access to a PDF's source, you can open to a page by adding &page=pagenum to the URL as noted at link html pdf page. You may also want to look at this question.

extract feed url from page in UIWebView

I'm writing just another feed reader and I want to make it easy to add new feeds, so I implement a UIWebView where you can browse the web and when you hit the Add button the current page should be scanned for rss feed URLs. But I don't get it.
I have no real idea about Javascript and DOM.
But I know you can get the content of a UIWebview with [wv stringByEvaluatingJavaScriptFromString:#"document.body.innerHTML"];.
So I tried #"document.head" but that doesn't work.
Is there a way to get the <head> of the currently displayed webpage with the help of some javascript?
Or even better, can I use javascript to get the actual feed urls?
I want to avoid to do another fetch on the url to get the html and then scan for the feed urls with NSScanner.
I'm looking forward to pushes into the right direction.
instead use "document.all[0].innerHTML". I am sure this will get you complete HTML source of your current web-page, and not just the content between body element. Then try scanning for element.

Categories