The line in the code below HtmlConverter.ConvertToPdf() is throwing an error stating "Invalid URI: The format of the URI could not be determined." and I can't figure it out.
Do I need a protocol prefix like file:// or is it something else?
The variable path resolves to '/data/user/0/com.companyname.worksmanager/files'
try
{
string strCPP;
using (StreamReader reader = new StreamReader(Application.Context.Assets.Open("CPP.html"), true))
{
strCPP = reader.ReadToEnd();
}
PdfWriter pdfWriter = new PdfWriter(new FileInfo(Path.Combine(path, "CPP.pdf")));
HtmlConverter.ConvertToPdf("<h1>test</h1>", pdfWriter);
}
catch(Exception ex)
{ }
Changing the way I create the file and changing the save directory still produces the same error message.
string pathPDF = Path.Combine(Android.App.Application.Context.GetExternalFilesDir(null).ToString(), "CPP.pdf");
HtmlConverter.ConvertToPdf(strCPP, new FileStream(pathPDF, FileMode.Create));