Convert PDF to Base64

How can I covert a PDF to Base64?

The PdfDocument object doesn't contain a property to get Base64 directly, though you can get the byte[] which can be used to get Base64.
using var pdf = new PdfDocument("MyPDF.pdf");
var ByteArray = pdf.BinaryData;
var Base64Result= Convert.ToBase64String(ByteArray);