Programmatic Html to PDF Generation using the WebView2 Control
Rick Strahl's Web Log
by Rick Strahl
3w ago
I've been using HTML to PDF generation for quite some time for a variety of purposes specifically in Markdown Monster. There are many solutions available - some good, some bad and many very expensive - but I've had good success in the past with the wkHtml2Pdf which is an open source solution that uses a standalone executable on Windows that allows conversion via the command line. While whHtml2Pdf works, it's getting a bit long in the tooth as it's based on a very old version of Chromium that is no longer maintained and well... there are a few quirks that will never get fixed as it's deprecate ..read more
Visit website
Reading Raw ASP.NET Request.Body Multiple Times
Rick Strahl's Web Log
by Rick Strahl
2M ago
Some time ago I wrote about retrieving raw HTTP request content from an incoming request and - surprisingly - it's one of the most popular posts on this blog. The post discusses a few ways how you can capture raw request content in ASP.NET Core applications in situations when traditional model binding/mapping doesn't work and you need to access the underlying raw request data. You can directly read the Request.Body stream to access content in raw form which is reading the request data explicitly, or if you're using Model Binding you implicitly get the data bound to objects in [FromBody] eithe ..read more
Visit website
Sharing Tab Missing in Windows Folder Properties
Rick Strahl's Web Log
by Rick Strahl
3M ago
For unfathomable reasons, Windows 11 is actively discouraging the Sharing Tab on the Explorer Properties Context Menu, where it used to sit by default. I'm talking about this tab when you select a drive or folder: From which you can then create a shared folder/drive and set permissions: This tab by default is not visible, and without it it's not exactly easy UI mechanism to create a shared folder/drive that you can access over the network which is just... weird. There are ways you can do this via the command line using net share, but AFAIK there's no other UI based way to share a folder. He ..read more
Visit website
Working around the WPF ImageSource Blues
Rick Strahl's Web Log
by Rick Strahl
3M ago
While working on the OpenAI Image Generator Addin from my previous post I ran into several behind the scenes issues related to the blasted Image control in WPF. Specifically I ran into two issues with a list of many images: A ginormous memory leak Blocking UI while loading many images Images in WPF have always been a nightmare due to the Image control and the damned ImageSource property that provides a very high level abstraction on top of various image semantics. On the one hand ImageSource is nice because it allows for an abstracted way to bind various sources of images, be it bitmaps, ve ..read more
Visit website
Integrating OpenAI Image Generation into a .NET Application
Rick Strahl's Web Log
by Rick Strahl
4M ago
I fell down a rabbit hole after playing around with various image generation AIs and decided that for me this is incredibly useful functionality that I would like to integrate into Markdown Monster - if for nothing else than for my own use. And boy did I ever end up using this tool a lot, not just in the context of MM but also for general image creation. I'm in constant need of images - for blog posts, for album art, for simple logos for various projects etc. I'm horrible at drawing and creating anything graphics art related has always been a struggle - I suck at it and hiring or auctioning o ..read more
Visit website
3.2 in progress Install .NET 8.0 Runtime if Ru...
Rick Strahl's Web Log
by Rick Strahl
5M ago
3.2 in progress Install .NET 8.0 Runtime if Runtime Missing MM now installs the .NET 8.0 runtime if .NET 7.0 or 8.0 is not installed. We're still compiling with a 7.0 target but automatically roll forward to 8.0 if available. If no 7.0 runtime is found, 8.0 is now installed. In future versions we'll switch to requiring 8.0 but for now either 7 or 8 are valid pre-requisites to avoid unnecessary installation of runtimes. Updated GitHub Preview Styling Minor tweaks to the GitHub default preview templates: Remove the grid outline when rendering under 980px frame width to reduce wasted space ..read more
Visit website
Embedding a minimal ASP.NET Web Server into a Desktop Application
Rick Strahl's Web Log
by Rick Strahl
5M ago
Have you ever wanted to embed a Web Server into another application like a Desktop app for example? It's not a common scenario but I've had a number of occasions where I've had a need for this: Markdown Monster Markdown Editor Provide an application server REST API that can be used for Web and other desktop applications to communicate with the running app. Html Help Builder (Documentation) Run a background Web Server to display rendered Http content for live previews of real time generated HTML content. In-house Templates Generator Similar to the documentation app - run a Web Server to ..read more
Visit website
Save Files With Elevated Permissions on UnauthorizedAccessException
Rick Strahl's Web Log
by Rick Strahl
6M ago
When building Desktop Applications that are document centric and that allow users to save files in any location - like an editor for example - you can run into a situation where on rare occasions a file needs to be saved in a location that doesn't have permissions to do so for the current user. Ideally the file shouldn't be saved in a restricted location, but sometimes you need to edit a file that lives in this restricted file location, and then save the file after making changes. This should be fairly rare, but I've seen a number of instances in my logs of users trying to save files in Markd ..read more
Visit website
Caching your WebView Environment to manage multiple WebView2 Controls
Rick Strahl's Web Log
by Rick Strahl
6M ago
I've been struggling with some WebView initialization issues that are showing up in my application logs from a deployed application. Personally I've never run into these issues myself, however my customers of Markdown Monster are running into UnauthorizedException errors occasionally, that occur deep in the innards of the WebView control. It's relatively rare - maybe a couple per 1000 application runs, but it's not zero. With a fair number of active users that adds up and makes for really messy logs that hide other information in the noise. To give you an idea what this looks like in Markdown ..read more
Visit website
Rolling Forward to Major Versions in .NET
Rick Strahl's Web Log
by Rick Strahl
7M ago
I'm currently playing around with .NET 8 RC Preview release and upgrading several of my applications to run under .NET 8 both Web server and Desktop based. In my early testing, moving those applications to .NET 8 has been very much a painless operation with zero required changes and only a few warnings/obsolescence related issues that had to be addressed. Nice! But - especially for my desktop applications - I wanted to start running the existing .NET 7 targeted applications under the .NET 8.0 preview to see if I'd run into any issues in day to day operations without fully converting or re-tar ..read more
Visit website

Follow Rick Strahl's Web Log on FeedSpot

Continue with Google
Continue with Apple
OR