Hi, Im using PDFSharp.Xamarin to try to create a PDF from some data gathered in a form, i have managed to get the code to compile however im now getting a runtime error using my android emulator,
Error: System.IO.DirectoryNotFoundException Message=Could not find a part of the path '/usr/share/fonts/truetype'.
Im wondering if someone could help me out, im unsure what i need to do to get this to work..
My code for creating the PDF:
Quote:
using PdfSharp.Xamarin;
using PdfSharpCore.Pdf;
using PdfSharpCore.Drawing;
public void FileWriter(string[] Data, string FileName) // Code to generate a PDF file
{
PdfDocument MyPDF = new PdfDocument();
PdfPage MyFirstPage = MyPDF.Pages.Add();
XGraphics Mygraphics = XGraphics.FromPdfPage(MyFirstPage);
XFont font = new XFont("Verdana", 20); //This is where the error appears
int x = 10, y = 10;
foreach (string Info in Data)
{
Mygraphics.DrawString(Info, font, XBrushes.Black, new XPoint(x, y));
y += 100;
}
MemoryStream stream = new MemoryStream();
MyPDF.Save(stream);
DependencyService.Get<ISave>().SaveToDownloads(FileName, "application / pdf", stream);
Any help on this will be greatly appreciated