//This requires the HtmlAgilityPack //string htmlSource = filename to a *.html/*.htm file with path private void GenerateReportFromHtmlToPdf(string htmlSource, string pdfTarget, Placeholders rep) { var tmpFile = Path.Combine(Path.GetDirectoryName(pdfTarget), Path.GetFileNameWithoutExtension(htmlSource) + Guid.NewGuid().ToString().Substring(0, 10) + ".html"); GenerateReportFromHtmlToHtml(htmlSource, tmpFile, rep); LibreOfficeWrapper.Convert(tmpFile, pdfTarget, _locationOfLibreOfficeSoffice); File.Delete(tmpFile); }
private void GenerateReportFromDocxToHtml(string docxSource, string htmlTarget, Placeholders rep) { var docx = new DocXHandler(docxSource, rep); var ms = docx.ReplaceAll(); var tmpFile = Path.Combine(Path.GetDirectoryName(htmlTarget), Path.GetFileNameWithoutExtension(docxSource) + Guid.NewGuid().ToString().Substring(0, 10) + ".docx"); StreamHandler.WriteMemoryStreamToDisk(ms, tmpFile); LibreOfficeWrapper.Convert(tmpFile, htmlTarget, _locationOfLibreOfficeSoffice); File.Delete(tmpFile); }