I have this PDF file that I have generated with OpenHTMLtoPDF
.
string html = "<html><body><h1>TEST</h1></body></html>";
var pdf = Pdf.From(html).OfSize(size);
byte[] content = pdf.Content();
However, I cannot figure out how to save it to the disk. There appears to not be a method to save to the hard drive.
It is very easy since pdf.content()
is passing you an array of bytes you can simply call File.WriteAllBytes()
to save the file to the hard drive.
using OpenHtmlToPdf;
using System.IO;
namespace Test{
class TestOpenHTMLtoPDF{
private void Main(){
string html = "<html><body><h1>TEST</h1></body></html>";
var pdf = Pdf.From(html).OfSize(size);
byte[] content = pdf.Content();
File.WriteAllBytes(@"C:\Test.pdf", content);
}
}
}