Here is an quick example how to encode/decode a string to base64. This example works already on .net core 2.0 or above.
If you need an PDF library, wich converts an HTML document to a PDF you need a library. There are a lot of libraries on the market, but only a few wich are free and open source. In my projects i used the DinkToPdf library, wich is a wrapper for the webkit engine (the chrome engine) for c#/.Net Core. The library needs as dependency the wkhtmltopdf library, wich you need to add manually.