Пример #1
0
        public async Task With_header()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();
            ConversionResult result = (await prizmDocServer.ConvertAsync("documents/example.docx", new DestinationOptions(DestinationFileFormat.Tiff)
            {
                Header = new HeaderFooterOptions()
                {
                    Lines = new List<HeaderFooterLine>()
                    {
                        new HeaderFooterLine()
                        {
                            Left = "Top Left",
                            Center = "THIS IS HEADER CONTENT",
                            Right = "Top Right",
                        },
                    },
                },
            })).Single();

            result = await prizmDocServer.OcrToPdfAsync(new ConversionSourceDocument(result.RemoteWorkFile));
            string[] pagesText = await TextUtil.ExtractPagesText(result.RemoteWorkFile);
            foreach (string page in pagesText)
            {
                StringAssert.Contains(page, "Top Left");
                StringAssert.Contains(page, "THIS IS HEADER CONTENT");
                StringAssert.Contains(page, "Top Right");
            }
        }
        public async Task With_footer()
        {
            PrizmDocServerClient prizmDocServer = Util.CreatePrizmDocServerClient();
            ConversionResult     result         = await prizmDocServer.ConvertToPdfAsync("documents/example.docx", footer : new HeaderFooterOptions()
            {
                Lines = new List <HeaderFooterLine>()
                {
                    new HeaderFooterLine()
                    {
                        Left   = "Bottom Left",
                        Center = "THIS IS FOOTER CONTENT",
                        Right  = "Bottom Right",
                    },
                },
            });

            string[] pagesText = await TextUtil.ExtractPagesText(result.RemoteWorkFile);

            foreach (string page in pagesText)
            {
                StringAssert.Contains(page, "Bottom Left");
                StringAssert.Contains(page, "THIS IS FOOTER CONTENT");
                StringAssert.Contains(page, "Bottom Right");
            }
        }
Пример #3
0
        private async Task AssertRedactionOccurredFor(RemoteWorkFile result)
        {
            // Quick sanity check to verify redaction actually occurred
            string[] pagesText = await TextUtil.ExtractPagesText(result);

            Assert.IsTrue(pagesText[0].Contains("Peter Parker"), "Hmm, text content we expected to be in the output document was not present. Did something go wrong?");
            Assert.IsFalse(pagesText[0].Contains("*****@*****.**"), "Content that was expected to be redacted was not actually redacted!");
            Assert.IsTrue(pagesText[0].Contains("(b)(6)"), "Expected redaction reason was not present!");
        }