/// <summary>
        /// Compares two PDF files using iText's CompareTool.
        /// </summary>
        /// <param name="dest">the PDF that resulted from the test</param>
        /// <param name="cmp">the reference PDF</param>
        protected void ComparePdf(string dest, string cmp)
        {
            if (string.IsNullOrEmpty(cmp))
            {
                return;
            }
            CompareTool compareTool = new CompareTool();
            string      outPath     = "./target/" + new DirectoryInfo(dest).Parent;

            new DirectoryInfo(outPath).Create();
            if (compareRenders)
            {
                AddError(compareTool.Compare(dest, cmp, outPath, differenceImagePrefix));
                AddError(compareTool.CompareLinks(dest, cmp));
            }
            else
            {
                AddError(compareTool.CompareByContent(dest, cmp, outPath, differenceImagePrefix));
            }
            AddError(compareTool.CompareDocumentInfo(dest, cmp));


            if (errorMessage != null)
            {
                Assert.Fail(errorMessage);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Compares two PDF files using iText's CompareTool.
        /// </summary>
        /// <param name="dest">the PDF that resulted from the test</param>
        /// <param name="cmp">the reference PDF</param>
        protected void ComparePdf(string dest, string cmp)
        {
            if (string.IsNullOrEmpty(cmp)) 
                return;
            CompareTool compareTool = new CompareTool();
            string outPath = "./target/" + new DirectoryInfo(dest).Parent; 
            new DirectoryInfo(outPath).Create();
            if (compareRenders)
            {
                AddError(compareTool.Compare(dest, cmp, outPath, differenceImagePrefix));
                AddError(compareTool.CompareLinks(dest, cmp));
            }
            else
            {
                AddError(compareTool.CompareByContent(dest, cmp, outPath, differenceImagePrefix));
            }
            AddError(compareTool.CompareDocumentInfo(dest, cmp));


            if (errorMessage != null) 
                Assert.Fail(errorMessage);
        }