dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.54k stars 25.3k forks source link

Streaming sample works even for other document types (like PDF) with a small change #31948

Closed maraf closed 3 weeks ago

maraf commented 6 months ago

Description

I recently had a conversion with blazor customer who has a need to preview other document types (like PDF). The documentation sample for streaming images works for other document types as well with two changes

I have put it together and created a sample https://github.com/maraf/blazor-file-stream.

I'm opening this issue as a consideration for mentioning pain-points in more general usage or providing the more general sample

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/images?view=aspnetcore-8.0#stream-image-data

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/images.md

Document ID

66bb1712-60ac-77a6-10d2-f2d795126783

Article author

@guardrex

maraf commented 6 months ago

This time I have used the button in the documentation page 🎉 (thanks guardrex!)

guardrex commented 6 months ago

Thanks @maraf ... Let's ask @mkArtakMSFT to triage.

mkArtakMSFT commented 5 months ago

Thanks for the suggestion, @maraf . I am not a fan of iframe-s in general. Also, I like to keep our samples focused only for the scenario they target, as otherwise it expands the surface area for questions. Because "I am not a fan of iframe-s" is not a technical justification, I'm willing to hear what @javiercn has to say about this.

maraf commented 5 months ago

Just a note on iframe, embed or object are alternatives

javiercn commented 5 months ago

I think we can add a section on the docs. If for example creating a blob url with the right content type works for displaying a PDF inside an iframe, that's a valid scenario.

guardrex commented 5 months ago

I'll use that example exactly (PDF in an iframe).

I'm working down all of the backlogged issues now that have been on hold while .NET 8 issues were the priority. I'll get to this in due course, probably within a month ... or three! 🙈😆

maraf commented 5 months ago

No rush, it's just a trifle