private void ConvertToPdf(string tmpFile, string tmpDocx, string profile = null) { try { LibreOfficeUtils.Convert(tmpDocx, tmpFile, profile); } catch (Exception e) { throw ExitCode.PdfConversionFailed(tmpDocx, e).ToCommandException(); } }
private void ConvertToPdfs(IEnumerable <string> docs, string outputDir, string profile = null) { try { LibreOfficeUtils.ConvertFiles(docs, outputDir, profile); } catch (Exception e) { throw ExitCode.PdfBatchConversionFailed(outputDir, e).ToCommandException(); } }
private void EnsureLibreOffice() { if (!LibreOfficeUtils.IsLibreOfficeOnPath()) { var(found, sofficePath) = LibreOfficeUtils.FindLibreOfficeBinary(); if (found) { var oldValue = Environment.GetEnvironmentVariable("PATH"); var newValue = oldValue + Path.PathSeparator + Path.GetDirectoryName(sofficePath); Environment.SetEnvironmentVariable("PATH", newValue); } else { throw ExitCode.LibreOfficeNotFound().ToCommandException(); } } if (!LibreOfficeUtils.HasLibreOfficeProfile()) { throw ExitCode.NoLibreOfficeProfile(LibreOfficeUtils.ExpectedProfileDir).ToCommandException(); } }