public async Task ConvertOfficeFile(string inFilePath, string outFilePath) { string errText = "NONE"; try { PDFDoc pdfDoc = new PDFDoc(); OfficeToPDFOptions options = null; //string pathToPdfTronFontResources = "C:\\Users\\hliao\\Documents\\Github\\FieldMobileApp\\App\\Field.Mobile\\Field.Mobile.Droid\\obj\\Debug\\100\\designtime\\Resource.designer.cs"; //options.SetLayoutResourcesPluginPath(pathToPdfTronFontResources); pdftron.PDF.Convert.OfficeToPDF(pdfDoc, inFilePath, options); await pdfDoc.SaveAsync(outFilePath, SDFDocSaveOptions.e_remove_unused); } catch (Exception ex) { pdftron.Common.PDFNetException pdfNetEx = new pdftron.Common.PDFNetException(ex.HResult); if (pdfNetEx.IsPDFNetException) { errText = string.Format("Exeption at line {0} in file {1}", pdfNetEx.LineNumber, pdfNetEx.FileName); errText += Environment.NewLine; errText += string.Format("Message: {0}", pdfNetEx.Message); } else { errText = ex.ToString(); } } if (!errText.Equals("NONE")) { //look at the error text var x = errText; } }
private async void OverwriteOldDocument() { await pdfDoc.SaveAsync(); }