I don't think you can open Excel-documents in current browsers. PDF'files works in som browsers, but not in older ones. Using and Object tag might be better than iframe, due to its ability to show a link if there is no pdf-handler in the browser. You can use an object tag which will allow the. Generally if Adobe Reader is installed a plugin was installed for the browser as well. This code displays a link to the. As jprochazka said, you can us the object tag to embed a pdf.
Most browsers will allow that. Mobile browsers, such as tablets and smartphones will be a completely different story.
Other file formats such as word, excel, etc.. Those documents embed in IE nicely because they are what is known as an Active Document. Their viewers can be hosted by the browser container in IE, but not well with other browsers. It may be best to use display them outside the browser as it can also avoid confusion.
People see a word doc opening in screen and often think they can edit it and save. Of course, nothing is going to happen in that case since you don't have mechanisms to communicate back to the server with the document.
Bottom line, PDFs can be embedded for many platforms but not all, others the mileage will vary even further with far fewer cross-browser and very limited cross-platform options and possibilities.
Is am doing correct? Google Docs Viewer is a good solution for your needs. It is just HTML code and you need to embed into your asp. We use it at our website for displaying a PDF file. Give it a try it.
It appears you are connected to the Internet, but you might want to try to reconnect to the Internet. I checked the pdf file properties where the pdf file exist there it mentioned that open with Adobe Reader is that is the problem? And you're right, I don't really need to return isError. I've modified the code and really appreciate the link. I meant the filestream you manually open after you already allocated the file bytes in the content byte-array. If it doesn't work, your file bytes must be corrupt.
Use a static pdf file and see if it works. The primary focus of the action being on how the response is returned. Nkosi Nkosi k 31 31 gold badges silver badges bronze badges. So if I didn't miss anything: The only thing you changed is the endpoint which is now split in 2 different functions including the endpoint only returning one item?
If it's not recomended to return 2 values, the why is System. ValueTuple a thing? WouterVanherck the value tuple is a thing yes but it was not meant for the MVC action results. WouterVanherck second if you review the refactored code you will see how the action is returning just the IActionResult abstraction, which can either be the PDF file or the JSON error response but not both. Yes, I noticed that you're only returning the Json when an error is thrown and that there's no Json returned when the code is successful.
I'm trying this out now since I agree that I can do without the Json in the success. Tried it out, doesn't throw any errors but doesn't open a PDF either. Same result as described earlier when I passed content — Wouter Vanherck. GetDocumentStream ; return File document. GetInstance doc, ms ; writer. Open ; doc. Add new Paragraph "Hello World" ; doc. Close ; writer. Adam Vincent Adam Vincent 2, 10 10 silver badges 34 34 bronze badges. When using your MyPdfCreator class: 'PdfWriter: type used in a using statement must be implicitly convertible to 'System.
IDisposable' — Wouter Vanherck. I was using PdfStamper , i swapped in PdfWriter. I should have known better. I have added in proper disposal like I wanted. Ask Question. HTML Markup. Net LinkButton and a Literal control. The below event handler is raised when the View LinkButton is clicked.
End Sub. Adobe PDF Reader installed. Adobe PDF Reader not installed. View Demo. Related Articles. Add Comments. Thank you for the feedback. The comment is now awaiting moderation.
0コメント