Embedding PDF from server in Browser - asp.net

I have an ASP.NET web application.I have some PDF files in my server .I want to show those to the user via browser in a new window.how to embed PDF in a browser ? i want the save option to be available for the user to save the PDF .How to go ahead

take a look at
http://pdfobject.com/
<html>
<head>
<script type="text/javascript" src="/scripts/pdfobject.js"></script>
<script type="text/javascript">
window.onload = function (){
var success = new PDFObject({ url: "/pdf/sample.pdf" }).embed("pdf");
};
</script>
</head>
<body>
<div id="pdf">It appears you don't have Adobe Reader
or PDF support in this web browser.
Click here to download the PDF</div>
</body>
</html>

PDF files opened in the browser can be susceptible to XSS, so it is usually best to configure the server so that, when a user requests a PDF, it is opened in it's native application e.g. Adobe Reader.
To configure IIS, open up IIS Manager and:
Right-click the folder on your site where the PDF files are kept and select 'Properties'
Go the the HTTP Headers tab
Click the 'File Types' button under the MIME Map section
Click 'New Type'
Add '.pdf' as the extension and 'appliction/octet-stream' as the Content Type
Click Ok and apply the changes
Now when the user clicks a link to a PDF they should be promted with the 'Open or Save' dialog box that you are after.

I've faced the same problem and a guy from Adobe has an (old) blog post about it link text
It works fine with IE, FF, Chrome with the default Adobe Reader plugin.
Now my only issue left is to display a nice loading thingy while the plugin retrieves the PDF file that is generated on-the-fly.

Related

LinkedIn Follow button plugin is opening a blank window

Using LinkedIn's site that creates the scripts for plugins, I created the plugin with the following script:
<script src="https://platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/FollowCompany" data-id="2922419" data-counter="top"></script>
I tried different things; with the https, without it (as they posted), but whenever I click on the button, it just opens up a blank window. What am I doing wrong?
it is not a big issue if LinkedIn Script is not working fine then just add your own onclick redirect url.i-e onclick="window.open('https://www.linkedin.com/company/{companyID}/');" and then add style="pointer-events:none;" css to its child(i.e LinkedIN scripts) to make its default behavior overridden.
Have you tried including the URL with your button? E.g:
<script type="IN/FollowCompany" data-id="2922419" data-counter="top" data-url="www.yourdomain.com/path/to/your/page"></script>
Replace the link with the page you want to share.

PDF iframe in UWP application

We have web application, it contains iframe with src attribute linking some pdf resource. In browsers (Edge, Chrome, Opera) user can see pdf in this iframe.
But now we createed UWP application showing the same html pages. When user open the page with this iframe, iframe is empty and the pdf is automaticaly opened in the browser window.
How to enable support for pdf in iframe in UWP application?
If I understand your question, you want to use WebView to show a web page. The web page has a <iframe> html tag, the iframe's src is a online pdf file. For the UWP built-in WebView control, it doesn't support pdf file.
So, if you want to render pdf in UWP, you could use Windows.Data.Pdf classes.
In addition, if you say you have to use WebView to show pdf file, you could try to find some JavaScript ways to render the pdf file on web page and then show it in WebView.

Video screen not rendered by html2canvas and jspdf, when downloading the webppage as pdf

I tried to download the web page as pdf by using html2canvas and jspdf. All elements of page like radio button, checkbox and label are rendered well. But if I add the embedded video into the page by iframe, it doesn't render at all.
Is there any way to render the embedded video into pdf by html2canvas and jspdf?
Thanks.
this is the screenshot of web page to be rendered.
And this is one of downloaded pdf.
I'm afraid html2canvas cannot render iframes. It says so clearly in the documentation:
The script doesn't render plugin content such as Flash or Java applets. It doesn't render iframe content either.
You could do this by other means, but not from the client, AFAIK.

Meteor: Exporting rendered template for offline use

I have an online tool for users to build and preview slideshow presentations (uploading images, editing text).
Would there be a way to "export" the content of a rendered slideshow for offline use? This would mean the user could view the presentation locally in a browser using only static files.
Use
var myRenderedHTML = Blaze.toHTMLWithData(templateYouWantToCache, dataUsedToRenderTemplate);
Then use something like the Filesaver.js library to force download of that content as an HTML file. (as in the last demo on this page)

Open an HTML file in Adobe Brackets

I'm a very unexperienced programmer. I've been doing codeacademy javascript track but I found out that you need to put javascript in an HTML file? I want to make sure that I can write basic javascript before continuing on code academy so I downloaded brackets and when I tried to test my program with the live preview feature it said, "Open an HTML file or make sure there is an index.html file in your project in order to launch live preview. I typed this up very quickly so there are probably plenty errors but here is the code if that helps answer my question.
<!DOCTYPE html>
<html>
<body>
<h1> Daily Programmer Challenge 12/15/14 </h1>
<script type = "text/javascript">
var volume = prompt ("Enter the volume of the container that you wish to make");
var cube = math.pow(volume, 1/3);
window.document.write("The size of the container is '+cube+' width, '+cube+' high, and '+cube+' tall");
</script>
</body>
</html>
save this code that you pasted as a file called index.html and then try Bracket's live preview.
For everyone, this problem can be resolved by following steps:-
On menu bar, go to File --> Open Folder (folder which have your html file for live preview)
Select Folder
Select your html file from left side bar for live preview
Click on bolt icon on right (preview button)
All it melts down to the fact, that you need that folder(which have your file) selected to view your output in live preview.
Let me know, if it helps someone. :)

Resources