public void TestAutoSave_MultipleOutputFiles_EnsureUniqueFilenamesIsEnabled_OutputFilenamesDoNotExist() { _th.GenerateGsJob(PSfiles.ThreePDFCreatorTestpages, OutputFormat.Jpeg); _th.Job.Profile.AutoSave.Enabled = true; _settings = new PdfCreatorSettings(null); _settings.ConversionProfiles.Add(_th.Job.Profile); _settings.ConversionProfiles[0].AutoSave.EnsureUniqueFilenames = true; _settings.ConversionProfiles[0].AutoSave.TargetDirectory = _th.TmpTestFolder; _settings.ConversionProfiles[0].FileNameTemplate = "AutoSaveTestOutput"; _settings.ConversionProfiles[0].OutputFormat = OutputFormat.Jpeg; var autoSaveWorkflow = new AutoSaveWorkflow(_th.Job, _settings); var expectedOutputFile1 = Path.Combine(_th.TmpTestFolder, "AutoSaveTestOutput1.jpg"); var expectedOutputFile2 = Path.Combine(_th.TmpTestFolder, "AutoSaveTestOutput2.jpg"); var expectedOutputFile3 = Path.Combine(_th.TmpTestFolder, "AutoSaveTestOutput3.jpg"); autoSaveWorkflow.RunWorkflow(); Assert.IsTrue(File.Exists(expectedOutputFile1), "Expected first outputfile does not exist."); Assert.IsTrue(File.Exists(expectedOutputFile2), "Expected second outputfile does not exist."); Assert.IsTrue(File.Exists(expectedOutputFile3), "Expected third outputfile does not exist."); var fileInfo = new FileInfo(expectedOutputFile1); Assert.IsFalse(fileInfo.Length == 0, "Expected first outputfile is empty."); fileInfo = new FileInfo(expectedOutputFile2); Assert.IsFalse(fileInfo.Length == 0, "Expected second outputfile is empty."); fileInfo = new FileInfo(expectedOutputFile3); Assert.IsFalse(fileInfo.Length == 0, "Expected third outputfile is empty."); }
public void TestAutoSave_SingleOutputFile_EnsureUniqueFilenameIsDisabled_OutputFilenameDoesExist_ExistingFileGetsOverwritten() { _th.GenerateGsJob(PSfiles.PDFCreatorTestpage, OutputFormat.Pdf); _th.Job.Profile.AutoSave.Enabled = true; _settings = new PdfCreatorSettings(null); _settings.ConversionProfiles.Add(_th.Job.Profile); _settings.ConversionProfiles[0].AutoSave.EnsureUniqueFilenames = false; _settings.ConversionProfiles[0].AutoSave.TargetDirectory = _th.TmpTestFolder; _settings.ConversionProfiles[0].FileNameTemplate = "AutoSaveTestOutput"; _settings.ConversionProfiles[0].OutputFormat = OutputFormat.Pdf; //create empty file, that should be overwritten var expectedOutputFile = Path.Combine(_th.TmpTestFolder, "AutoSaveTestOutput.pdf"); CreateFile(expectedOutputFile); var autoSaveWorkflow = new AutoSaveWorkflow(_th.Job, _settings); autoSaveWorkflow.RunWorkflow(); Assert.IsTrue(File.Exists(expectedOutputFile), "Expected outputfile does not exist."); var fileInfo = new FileInfo(expectedOutputFile); Assert.IsFalse(fileInfo.Length == 0, "Expected outputfile did not overwritte existing (empty) file."); }
public void TestAutoSave_SingleOutputFile_EnsureUniqueFilenameIsEnabled_OutputFilenameDoesExist_OutputfileGetsAppendix() { _th.GenerateGsJob(PSfiles.PDFCreatorTestpage, OutputFormat.Pdf); _th.Job.Profile.AutoSave.Enabled = true; _settings = new PdfCreatorSettings(null); _settings.ConversionProfiles.Add(_th.Job.Profile); _settings.ConversionProfiles[0].AutoSave.EnsureUniqueFilenames = true; _settings.ConversionProfiles[0].AutoSave.TargetDirectory = _th.TmpTestFolder; _settings.ConversionProfiles[0].FileNameTemplate = "AutoSaveTestOutput"; _settings.ConversionProfiles[0].OutputFormat = OutputFormat.Pdf; //create empty file with original output filename var existingFile = Path.Combine(_th.TmpTestFolder, "AutoSaveTestOutput.pdf"); CreateFile(existingFile); var expectedOutputFileWithAppendix = Path.Combine(_th.TmpTestFolder, "AutoSaveTestOutput_2.pdf"); var autoSaveWorkflow = new AutoSaveWorkflow(_th.Job, _settings); autoSaveWorkflow.RunWorkflow(); Assert.IsTrue(File.Exists(existingFile), "Already existing file with outputfilename does not exist anymore."); var fileInfo = new FileInfo(existingFile); Assert.IsTrue(fileInfo.Length == 0, "Already existing (empty) file with outputfilename has been overwritten."); Assert.IsTrue(File.Exists(expectedOutputFileWithAppendix), "Expected outputfile (with appendix) does not exist."); fileInfo = new FileInfo(expectedOutputFileWithAppendix); Assert.IsFalse(fileInfo.Length == 0, "Expected outputfile (with appendix) is empty."); }
public void AuthorTemplateTest() { _th.GenerateGsJob(PSfiles.PDFCreatorTestpage, OutputFormat.Pdf); _th.JobInfo.Metadata.PrintJobAuthor = "Author from Job"; _th.Job.Profile.AutoSave.Enabled = true; _settings = new PdfCreatorSettings(null); _settings.ConversionProfiles.Add(_th.Job.Profile); _settings.ConversionProfiles[0].AutoSave.EnsureUniqueFilenames = false; _settings.ConversionProfiles[0].AutoSave.TargetDirectory = _th.TmpTestFolder; _settings.ConversionProfiles[0].FileNameTemplate = "AutoSaveTestOutput"; _settings.ConversionProfiles[0].OutputFormat = OutputFormat.Pdf; _settings.ConversionProfiles[0].AuthorTemplate = "<PrintJobAuthor> + some text"; var autoSaveWorkflow = new AutoSaveWorkflow(_th.Job, _settings); autoSaveWorkflow.RunWorkflow(); var pdf = new PdfReader(_th.Job.OutputFiles[0]); Assert.AreEqual("Author from Job + some text", pdf.Info["Author"], "Wrong author in PDF Metadata"); }