public void SetUp() { _pdfProcessor = BuildPdfProcessor(); var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); container.Options.AllowOverridingRegistrations = true; container.Register(() => _pdfProcessor); container.Options.AllowOverridingRegistrations = false; _th = container.GetInstance <TestHelper>(); _th.InitTempFolder($"PDFProcessing_{_pdfProcessor.GetType().Name}_PDFA"); }
public void SetUp() { var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); _th = container.GetInstance <TestHelper>(); _th.InitTempFolder("PDFProcessing_IText_Encryption"); _th.GenerateGsJob_WithSetOutput(TestFile.PDFCreatorTestpagePDF); _th.Job.Passwords.PdfOwnerPassword = "******"; _th.Job.Passwords.PdfUserPassword = "******"; _pdfProcessor = BuildPdfProcessor(); }
public PdfTabViewModel(PdfTabTranslation translation, IInteractionInvoker interactionInvoker, IFile file, IOpenFileInteractionHelper openFileInteractionHelper, EditionHintOptionProvider editionHintOptionProvider, IPdfProcessor pdfProcessor, IUserGuideHelper userGuideHelper) { _file = file; _openFileInteractionHelper = openFileInteractionHelper; _pdfProcessor = pdfProcessor; Translation = translation; _interactionInvoker = interactionInvoker; _userGuideHelper = userGuideHelper; OnlyForPlusAndBusiness = editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint; SecurityPasswordCommand = new DelegateCommand(SecurityPasswordExecute); ChooseCertificateFileCommand = new DelegateCommand(ChooseCertificateFileExecute); DefaultTimeServerCommand = new DelegateCommand(DefaultTimeServerExecute); }
public JobRunner(IOutputFileMover outputFileMover, ITokenReplacerFactory tokenReplacerFactory, IPdfProcessor processor, IConverterFactory converterFactory, IActionManager actionManager, IJobCleanUp jobClean, ITempFolderProvider tempFolderProvider, IDirectory directory, IConversionProgress conversionProgress) { _outputFileMover = outputFileMover; _tokenReplacerFactory = tokenReplacerFactory; _processor = processor; _converterFactory = converterFactory; _actionManager = actionManager; _jobClean = jobClean; _tempFolderProvider = tempFolderProvider; _directory = directory; _conversionProgress = conversionProgress; }
public void SetUp() { var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); //override PasswordProvider, because tests write to job.passwords directly and the provider would replace those values with empty strings from the profile container.Options.AllowOverridingRegistrations = true; RegisterPdfProcessor(container); container.Register(() => Substitute.For <IProcessingPasswordsProvider>()); _pdfProcessor = container.GetInstance <IPdfProcessor>(); _th = container.GetInstance <TestHelper>(); _th.InitTempFolder("SigningTest"); _th.Profile.PdfSettings.Signature.CertificateFile = _th.GenerateTestFile(TestFile.CertificationFileP12); }
private void InitializeTest(TestFile tf) { _pdfProcessor = BuildPdfProcessor(); var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); _th = container.GetInstance <TestHelper>(); _th.InitTempFolder($"PDFProcessing_{_pdfProcessor.GetType().Name}_XMPMetadata"); _th.GenerateGsJob_WithSetOutput(tf); //Settings of the set outputfile _th.Job.JobInfo.Metadata.Title = "Test Title"; _th.Job.JobInfo.Metadata.Subject = "Test Subject"; _th.Job.JobInfo.Metadata.Keywords = "Test Keywords"; _th.Job.JobInfo.Metadata.Author = "Test Author"; }
public void SetUp() { PdfProcessor = BuildPdfProcessor(); var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); _accounts = new Accounts(); _timeServerAccount = new TimeServerAccount(); _accounts.TimeServerAccounts.Add(_timeServerAccount); TestHelper = container.GetInstance <TestHelper>(); TestHelper.InitTempFolder($"PDFProcessing_{PdfProcessor.GetType().Name}_Signing"); TestHelper.GenerateGsJob_WithSetOutput(TestFile.ThreePDFCreatorTestpagesPDF); TestHelper.Job.Profile.PdfSettings.Signature.AllowMultiSigning = true; ApplySignatureSettings(); }
public void SetUp() { var bootstrapper = new IntegrationTestBootstrapper(); var container = bootstrapper.ConfigureContainer(); _th = container.GetInstance <TestHelper>(); _th.InitTempFolder("PDFProcessing_IText_Basic"); var passwordsProvider = Substitute.For <IProcessingPasswordsProvider>(); passwordsProvider.When(x => x.SetEncryptionPasswords(Arg.Any <Job>())).Do(x => { var job = x[0] as Job; job.Passwords.PdfOwnerPassword = OwnerPassword; job.Passwords.PdfUserPassword = UserPassword; }); passwordsProvider.When(x => x.SetSignaturePassword(Arg.Any <Job>())).Do(x => { var job = x[0] as Job; job.Passwords.PdfSignaturePassword = SignaturePassword; }); _pdfProcessor = BuildPdfProcessor(passwordsProvider); }
private static void CheckPDFVersion(string testFile, ConversionProfile profile, JobPasswords passwords, IPdfProcessor pdfProcessor) { PdfReader pdfReader; if (profile.PdfSettings.Security.Enabled) { if (profile.PdfSettings.Security.RequireUserPassword) { pdfReader = new PdfReader(testFile, Encoding.Default.GetBytes(passwords.PdfUserPassword)); } else { pdfReader = new PdfReader(testFile, Encoding.Default.GetBytes(passwords.PdfOwnerPassword)); } } else { pdfReader = new PdfReader(testFile); } using (pdfReader) { CheckPDFVersion(pdfReader, profile, pdfProcessor); } }
public static void CheckPDFVersion(Job job, IPdfProcessor pdfProcessor) { CheckPDFVersion(job.OutputFiles[0], job.Profile, job.Passwords, pdfProcessor); }
public void SetUp() { _pdfProcessor = Substitute.For <IPdfProcessor>(); }
public void ProcessJob(IPdfProcessor pdfProcessor, Job job) { pdfProcessor.AddWatermark(job); }
public PdfManager(IPdfProcessor pdfProcessor, IXmlParser xmlParser) { this._pdfProcessor = pdfProcessor; this._xmlParser = xmlParser; }
public PdfAConverter(IPdfProcessor pdfProcessor) { _pdfProcessor = pdfProcessor; }
public BackgroundAdder(IPdfProcessor pdfProcessor) { _pdfProcessor = pdfProcessor; }
public PageNumberCalculator(IPdfProcessor processor) { _processor = processor; }
public void ProcessJob(IPdfProcessor processor, Job job) { processor.AddStamp(job); }
public PdfDirectConversion(IPdfProcessor pdfProcessor, ISettingsProvider settingsProvider, IJobInfoManager jobInfoManager) : base(settingsProvider, jobInfoManager) { _pdfProcessor = pdfProcessor; }
public void ProcessJob(IPdfProcessor pdfProcessor, Job job) { pdfProcessor.AddBackground(job); }
public static string TestMultipleSigning(string testFile, ConversionProfile profile, JobPasswords passwords, IPdfProcessor pdfProcessor, Accounts accounts) { using (var pdfReader = BuildPdfReader(testFile, profile, passwords)) { var doubleSignedFile = testFile.Replace(".pdf", "_doubleSignedFile.pdf"); var fileStream = new FileStream(doubleSignedFile, FileMode.Create, FileAccess.Write); var tempFile = testFile.Replace(".pdf", "_tempFile.pdf"); var intendedPdfVersion = pdfProcessor.DeterminePdfVersion(profile); var pdfVersion = PdfWriter.VERSION_1_4; if (intendedPdfVersion == "1.5") { pdfVersion = PdfWriter.VERSION_1_5; } else if (intendedPdfVersion == "1.6") { pdfVersion = PdfWriter.VERSION_1_6; } else if (intendedPdfVersion == "1.7") { pdfVersion = PdfWriter.VERSION_1_7; } //Create Stamper in append mode var stamper = PdfStamper.CreateSignature(pdfReader, fileStream, pdfVersion, tempFile, true); profile.PdfSettings.Signature.SignaturePage = SignaturePage.LastPage; var signer = new ITextSigner(); signer.SignPdfFile(stamper, profile, passwords, accounts); stamper.Close(); using (var doubleSignedPdfReader = BuildPdfReader(doubleSignedFile, profile, passwords)) { var af = doubleSignedPdfReader.AcroFields; Assert.AreEqual(2, af.GetSignatureNames().Count, "Number of SignatureNames must be 2" + Environment.NewLine + "(" + testFile + ")"); //There is currently no way for testing multisigning. //-> af.SignatureCoversWholeDocument(firstSignatureName) is always false, since a singature can't cover future signing //-> firstSignature.Verify() returns always true. /* * var firstSignatureName = af.GetSignatureNames()[0]; * var firstSignature = af.VerifySignature(firstSignatureName); * * if (profile.PdfSettings.Signature.AllowMultiSigning) * { * Assert.IsTrue(firstSignature.Verify(), "First signature is invalid altough multi signing was enabled"); * } * else * { * Assert.IsFalse(firstSignature.Verify(), "First signature is valid altough multi signing was disabled"); * } * //*/ return(doubleSignedFile); } } }
public static string TestMultipleSigning(Job job, IPdfProcessor pdfProcessor) { return(TestMultipleSigning(job.OutputFiles[0], job.Profile, job.Passwords, pdfProcessor, job.Accounts)); }
public static void CheckPDFVersion(PdfReader pdfReader, ConversionProfile profile, IPdfProcessor pdfProcessor) { var expectedVersion = pdfProcessor.DeterminePdfVersion(profile); if (expectedVersion == "1.7") { Assert.AreEqual(PdfWriter.VERSION_1_7, pdfReader.PdfVersion, "Not PDF-Version 1.7"); } else if (expectedVersion == "1.6") { Assert.AreEqual(PdfWriter.VERSION_1_6, pdfReader.PdfVersion, "Not PDF-Version 1.6"); } else if (expectedVersion == "1.5") { Assert.AreEqual(PdfWriter.VERSION_1_5, pdfReader.PdfVersion, "Not PDF-Version 1.5"); } else if (expectedVersion == "1.4") { Assert.AreEqual(PdfWriter.VERSION_1_4, pdfReader.PdfVersion, "Not PDF-Version 1.4"); } else { Assert.AreEqual(PdfWriter.VERSION_1_3, pdfReader.PdfVersion, "Not PDF-Version 1.3"); } }
public void ProcessJob(IPdfProcessor processor, Job job) { processor.AddCover(job); }
public void ProcessJob(IPdfProcessor processor, Job job) { processor.AddAttachment(job); }
public ActionExecutor(IActionManager actionManager, IPdfProcessor pdfProcessor, IPdfProcessingHelper processingHelper) { _actionManager = actionManager; _pdfProcessor = pdfProcessor; _processingHelper = processingHelper; }
public void ProcessJob(IPdfProcessor processor, Job job) { //nothing to do here. The Encryption must be triggered as last processing step in the ActionManager }
public DirectConversionHelper(IPdfProcessor pdfProcessor, IFile file) { _pdfProcessor = pdfProcessor; _file = file; }