You can create in-memory PDFs with C# using a few nuget libraries; itext7, itext7.bouncy-castle-adapter and itext7.pdfhtml. Here's some code how you might accomplish that. Much thanks goes to mklfrom StackOverflow who has a wealth of knowledge on this topic.
Code
Explanation
The method to create in-memory PDFs relies on a MemoryStream. The alternate approach would be to use a FileStream, but speaking from experience, I would suggest to use a MemoryStream over a FileStream as it offers the benefit of being more lightweight, doesn't use any IO resources, and eliminates potential errors in a multi-threaded environment. The MemoryStream will hold the entire contents of our PDF until we write out the contents of the MemoryStream to file.
In our example, we create PDFs using HtmlConverter.ConvertToPdf. The results of this conversion get copied into the masterStream if it's the first HTML to be convereted. If we convert further HTML into PDFs, we copy the new PDF at the end of the existing PDF content we've already created. At the end of the program, we write out the in-memory PDF to a file.
Code
A working solution of the code above can be found here.