/// <summary> /// Moves original file to preprocess file, which is the original file with an appended "_PrePdfProcessor.pdf". /// </summary> /// <param name="pdfFile">Full path to PDF file</param> /// <param name="appendix">filename is oldname_APPENDIX.pdf</param> /// <returns>Path to preprocess file</returns> public string MoveFileToPreProcessFile(string pdfFile, string appendix) { string preProcessFile; try { preProcessFile = _pathSafe.ChangeExtension(pdfFile, "_" + appendix + ".pdf").Replace("._", "_"); File.Move(pdfFile, preProcessFile); } catch (Exception ex) { Logger.Error(ex.GetType() + " while creating pdf preprocess file:" + Environment.NewLine + ex.Message); throw new ProcessingException( ex.GetType() + " while creating pdf preprocess file:" + Environment.NewLine + ex.Message, ErrorCode.Processing_GenericError); } return(preProcessFile); }
/// <summary> /// Moves original file to preprocess file, which is the original file with an appended "_PrePdfProcessor.pdf". /// </summary> /// <param name="pdfFile">Full path to PDF file</param> /// <returns>Path to preprocess file</returns> protected string MoveFileToPreProcessFile(string pdfFile) { string preProcessFile; try { //create copy of original file preProcessFile = _pathSafe.ChangeExtension(pdfFile, "_PrePdfProcessor.pdf").Replace("._", "_"); File.Move(pdfFile, preProcessFile); } catch (Exception ex) { _logger.Error(ex.GetType() + " while creating pdf preprocess file:" + Environment.NewLine + ex.Message); throw new ProcessingException( ex.GetType() + " while creating pdf preprocess file:" + Environment.NewLine + ex.Message, ErrorCode.Processing_GenericError); } return(preProcessFile); }
public string MakeValidExtension(string filename, OutputFormat format) { var validExtensions = GetValidExtensions(format); return(PathSafe.ChangeExtension(filename, validExtensions[0])); }