Reloading embed PDF in a DIV (empty Accrobat Reader error popup) - embed

I have a web application coded in C#/ASP.NET. The application basically exports a PDF file when the user click on Save. It then reloads a DIV, putting the EMBED (with the src pointing to the newly generated pdf file) in it. Sometimes the embed area just gets black and I get this window from Acrobat Reader: http://img180.imageshack.us/img180/3359/acreader.jpg. What does it mean? Has anyone ever see this?

embedding PDF's in web pages is pretty rubbish overall. Try using the open source lib FlexPaper instead;
http://flexpaper.devaldi.com

Related

How to preview local files in the browser in another html page

i am looking for a creative solution for a new task.
my issue is we need a way to preview local files (extentions: doc, docx, ppt, pptx, pdf, tif, jpeg) in a frame or so of a different web page which provides a link.
preview should look like an image of the files or so.
we would like to prevent parsing the files to pdf in order to save time...
we are using angular 7, c# asp.net server side.
we are very limitted in most solutions, as the data is very secure and is used in an inner office net,
that is why we can't use the google docs solution.
i also understood that using iframe tag and pointing it src attribute to the file source doesn't load the page due to security resones.
in addition all users has the ability to preview the above files types when they do it straight from the document by the open with -> IE or other browsers options.
i tried :
<iframe src="file:///C:/Users/cd/Downloads/MyFile.docx"></iframe>
but:
the iframe tag doesn't open the doc file, i can see the iframe in the DOM as a new html but it doesnt have a content of anything
i tried also for images and the same, the frame is blank
If you are using chrome then chrome specifically blocks local file access this way for security reasons.
more detail is this link : here
One possible solution is, render the document pages as images and then display them on the web page i.e. using the iframe.
You may use GroupDocs.Viewer for .NET for rendering the document pages into high-fidelity images (PNG/JPG). You can then embed the images into your web page to preview the document. This is how you can get the image representation of the pages in a Word document:
using GroupDocs.Viewer.Options;
// Set output path
string OutputPagePathFormat = Path.Combine("D:\\output", "page_{0}.png");
// Render document pages
using (Viewer viewer = new Viewer("D:\\sample.docx"))
{
PngViewOptions options = new PngViewOptions(OutputPagePathFormat);
viewer.View(options);
// Rendered images will be saved in the D:\output\ directory.
}
Disclosure: I work as a developer evangelist at GroupDocs.

Embedding an Excel workbook in a web page

I'm using Microsoft's One Drive to share an Excel workbook by embedding it into a web page using the iframe tag.
I've got the code that One Drive provides and it displays fine on the page. However, it's possible for a user to click the icon in the black bar at the bottom and view the Workbook full screen.
I don't have a problem with that, but it then gives the option to download, copy and share the entire file and that is a problem.
I've found parameters that can be used with the workbook link such as wdHideGridlines, but is there anything that will get rid of that black bar? Or anything that will stop someone downloading the file?
It seems that you can embed a file with OneDrive and it's open for all, or you can use the 'share' option and get a view-only link, but I can't seem to embed that link - it displays an Excel icon for the workbook rather than a view of the data.
I hope this makes sense, if anyone can help I'd be grateful.
At the moment, the only way to prevent the download is to hide the download command on the web page with CSS.
Cast your vote in this user voice idea. https://excel.uservoice.com/forums/274580-excel-online/suggestions/19274656-remove-the-download-option
If it gets sufficient votes, Microsoft will consider implementing it.

Open link in new tab of browser from PDF file

I have created the PDF file programmatically. For this, I have used the HTML to PDF converting library. In my PDF there are some links for some pages of website.
I have implemented the html by following way and then converted it to PDF programmatically.
<a target="_blank" href="http://mywebsite_url_here.html">Link</a>
But when opening this PDF into chrome or firefox browser and clicking on the any link exist in PDF. Links are opening is same TAB instead of the new TAB. Please help to find out the solution for this. so that my PDF reside in one tab and link will open in another tab in browser.
I have already tried
target="_blank"
target="_top"
<a onclick="window.open ('http://mywebsite_url_here.html', '');
return false" href="javascript:void(0);"></a>
But nothing has worked for me.
Short answer: It is not possible in a cross-plattform, guaranteed-to-work way.
Long answer: Hyperlinks in a PDF are different from Hyperlinks in HTML. PDF was not designed to be viewed as part of a browsing experience. Hence there is no option available for PDF Hyperlinks to open them in a new tab, because PDF does not know about the concept of tabs.
There is some discussion in Adobe's forums about it, which boils down to „not directly possible, but you could embed JavaScript in the PDF to do it“. They give an EPS file as example:
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 100 100
%%EndProlog
[ /Rect [ 0 0 100 100 ]
/Action << /Subtype /JavaScript /JS (app.launchURL\("PLACE-YOUR-URL-HERE", true\);) >>
/Subtype /Link
/ANN pdfmark
%%EOF
Now before you try and get this EPS file embedded in your PDF, be aware that Chrome's PDF viewer has very little support for embedded JavaScript, so it is not guaranteed to work. It may also issue a warning to the User that there is JavaScript code going to be executed if they click on it. I would say it isn't worth the hassle.

How to force a Download File prompt instead of displaying it in-browser with HTML?

Download
If I click Download button, this target blank is opening a new window.
But I need it to prompt a dialog for saving this file. How can I achieve this?
This is something that you cannot absolutely control with HTML itself.
If the user is having a browser with PDF reading capabilities (or a plugin) and the corresponding settings to open PDF files in-browser, the PDF will open like that.
The PDF opens in a new tab simple because of your target="_blank", which has nothing to do with a download prompt.
If you are using HTML5 you can use the download attribute:
Download
If you have a back-end service which you can control or you feel like fiddling with your Web Server, you can always look for setting the right Content-Disposition. See this SO question for some nice discussion on Content-Disposition.

HTML input type = file in Adobe AIR does not present file browser

So the good old HTML file uploader tag only presents a browse button (without associated text input) when rendered in a HTML based Adobe AIR application. Upon clicking the browse button, nothing seems to happen. I would expect a popup window so I can select a file. I've seen examples of people using Javascript to call the AIR runtime to get a file and upload it, but I was wondering if anyone knew a complete HTML/Javascript way of doing this with AIR.
thanks
Actually, this does work. I somehow managed to stop this from working, probably through a combination of cloning that part of the DOM elsewhere.