当前位置: 首页>>代码示例>>C#>>正文


C# CompareTool.Compare方法代码示例

本文整理汇总了C#中CompareTool.Compare方法的典型用法代码示例。如果您正苦于以下问题:C# CompareTool.Compare方法的具体用法?C# CompareTool.Compare怎么用?C# CompareTool.Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CompareTool的用法示例。


在下文中一共展示了CompareTool.Compare方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestFlattening

        public virtual void TestFlattening()
        {
            const string INPUT_FOLDER = RESOURCES_FOLDER + "input/";
            const string CMP_FOLDER = RESOURCES_FOLDER + "cmp/";
            if (File.Exists(INPUT_FOLDER))
                Assert.Fail("Input folder can't be found (" + INPUT_FOLDER + ")");

            Directory.CreateDirectory(OUTPUT_FOLDER);

            String[] files = Directory.GetFiles(INPUT_FOLDER, "*.pdf");

            foreach (String file in files)
            {
                // flatten fields
                PdfReader reader = new PdfReader(file);
                PdfStamper stamper = new PdfStamper(reader, new FileStream(OUTPUT_FOLDER + Path.GetFileName(file), FileMode.Create));
                stamper.FormFlattening = true;
                stamper.Close();

                // compare
                CompareTool compareTool = new CompareTool();
                String errorMessage = compareTool.Compare(OUTPUT_FOLDER + Path.GetFileName(file), CMP_FOLDER + Path.GetFileName(file), OUTPUT_FOLDER, "diff");
                if (errorMessage != null)
                {
                    Assert.Fail(errorMessage);
                }
            }
        }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:28,代码来源:FlatteningTest.cs

示例2: CompareDocuments

 private void CompareDocuments(String @out, String cmp, bool visuallyOnly) {
     CompareTool compareTool = new CompareTool();
     String errorMessage;
     if (visuallyOnly) {
         errorMessage = compareTool.Compare(outFolder + @out, cmpFolder + cmp, outFolder, "diff");
     } else {
         errorMessage = compareTool.CompareByContent(outFolder + @out, cmpFolder + cmp, outFolder, "diff");
     }
     if (errorMessage != null)
         Assert.Fail(errorMessage);
 }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:11,代码来源:NestedTablesTest.cs

示例3: LabSpotBasedGradient

        public virtual void LabSpotBasedGradient() {
            // step 1
            Document document = new Document(PageSize.A3);
            // step 2
            String dest_file = DEST_FOLDER + "/lab_spot_based_gradient.pdf";
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(dest_file, FileMode.Create));
            // step 3
            document.Open();
            // step 4
            PdfContentByte canvas = writer.DirectContent;
            PdfLabColor pdfLabColor = new PdfLabColor(new float[] {0.9505f, 1.0f, 1.0890f}, new float[] {0f, 0.5f, 1.5f},
                new float[] {-10, 100, -10, 100});
            PdfDeviceNColor pdfDeviceNNChannelColor =
                new PdfDeviceNColor(new PdfSpotColor[] {
                    new PdfSpotColor("lab3", pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83))),
                    new PdfSpotColor("labBlue", pdfLabColor.Rgb2lab(new BaseColor(0, 0, 255)))
                });
            PdfSpotColor psc_lab3 = new PdfSpotColor("lab3", pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83)));
            PdfSpotColor psc_lab2 = new PdfSpotColor("lab2", pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96)));
            PdfSpotColor psc_lab1 = new PdfSpotColor("lab1", pdfLabColor.Rgb2lab(new BaseColor(255, 0, 0)));
            PdfSpotColor psc_lab_blue = new PdfSpotColor("labBlue", new BaseColor(0, 0, 100));

            PdfDeviceNColor pdfDeviceNNChannelColor2 = new PdfDeviceNColor(new PdfSpotColor[]{psc_lab_blue, psc_lab2, psc_lab1});

            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(0, 0, 255)), 36, 878, 36, 36);
            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96)), 90, 878, 36, 36);
            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83)), 144, 878, 36, 36);
            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(0, 50, 50)), 198, 878, 36, 36);

            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(0, 0, 255)).ToRgb(), 36, 824, 36, 36);
            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96)).ToRgb(), 90, 824, 36, 36);
            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83)).ToRgb(), 144, 824, 36, 36);
            ColorRectangle(canvas, pdfLabColor.Rgb2lab(new BaseColor(0, 50, 50)).ToRgb(), 198, 824, 36, 36);


            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab1", pdfLabColor.Rgb2lab(new BaseColor(255, 0, 0))), 1f), 36, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab1", pdfLabColor.Rgb2lab(new BaseColor(255, 0, 0))), 0.8f), 90, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab1", pdfLabColor.Rgb2lab(new BaseColor(255, 0, 0))), 0.6f), 144, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab1", pdfLabColor.Rgb2lab(new BaseColor(255, 0, 0))), 0.2f), 198, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab2", pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96))), 1f), 252, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab2", pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96))), 0.8f), 306, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab2", pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96))), 0.6f), 360, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab2", pdfLabColor.Rgb2lab(new BaseColor(70, 138, 96))), 0.2f), 416, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab3", pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83))), 1.0f), 470, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab3", pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83))), 0.8f), 524, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab3", pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83))), 0.6f), 578, 986, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("lab3", pdfLabColor.Rgb2lab(new BaseColor(0, 217, 83))), 0.2f), 634, 986, 36, 36);

            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb1", new BaseColor(255, 0, 0)), 1f), 36, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb1", new BaseColor(255, 0, 0)), 0.8f), 90, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb1", new BaseColor(255, 0, 0)), 0.6f), 144, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb1", new BaseColor(255, 0, 0)), 0.2f), 198, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb2", new BaseColor(70, 138, 96)), 1f), 252, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb2", new BaseColor(70, 138, 96)), 0.8f), 306, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb2", new BaseColor(70, 138, 96)), 0.6f), 360, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb2", new BaseColor(70, 138, 96)), 0.2f), 416, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb3", new BaseColor(0, 217, 83)), 1.0f), 470, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb3", new BaseColor(0, 217, 83)), 0.8f), 524, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb3", new BaseColor(0, 217, 83)), 0.6f), 578, 932, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("rgb3", new BaseColor(0, 217, 83)), 0.2f), 634, 932, 36, 36);

            ColorRectangle(canvas, new DeviceNColor(new PdfDeviceNColor(new PdfSpotColor[]{psc_lab2, psc_lab_blue, psc_lab1}), new float[]{0, 0.0f, 1}), 36, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{0.1f, 0.1f}), 90, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{0.2f, 0.2f}), 144, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{0.3f, 0.3f}), 198, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{0.4f, 0.4f}), 252, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(new PdfDeviceNColor(new PdfSpotColor[]{psc_lab2, psc_lab_blue, psc_lab1, psc_lab3}), new float[]{0.5f, 0.5f, 1, 0.5f}), 306, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor2, new float[]{0.6f, 0.1f, 0.5f}), 360, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{0.7f, 0.7f}), 416, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{0.8f, 0.8f}), 470, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(new PdfDeviceNColor(new PdfSpotColor[]{psc_lab2, psc_lab_blue, psc_lab1}), new float[]{0.9f, 0.9f, 1}), 524, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{1, 1}), 578, 770, 36, 36);

            canvas.SaveState();
            canvas.Rectangle(418, 412, -329, 189);
            canvas.Clip();
            canvas.NewPath();
            canvas.SaveState();
            canvas.ConcatCTM(329f, 0f, 0f, -329f, 89f, 506.5f);
            canvas.PaintShading(PdfShading.SimpleAxial(writer, 0, 0, 1, 0, new DeviceNColor(pdfDeviceNNChannelColor, new float[]{1, 0}), new DeviceNColor(pdfDeviceNNChannelColor, new float[]{ 0, 1})));
            canvas.RestoreState();
            canvas.RestoreState();
            canvas.SetColorStroke(new DeviceNColor(pdfDeviceNNChannelColor, new float[]{1, 1}));
            canvas.Rectangle(418, 412, -329, 189);
            canvas.Stroke();

            // step 5
            document.Close();

            CompareTool compareTool = new CompareTool();
            String error = compareTool.Compare(dest_file, TEST_RESOURCES_PATH +  "cmp_lab_spot_based_gradient.pdf", DEST_FOLDER, "diff");
            if (error != null) {
                Assert.Fail(error);
            }
        }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:95,代码来源:LabColorSpaceTest.cs

示例4: DeviceNSpotBasedGradient

        public virtual void DeviceNSpotBasedGradient() {
            // step 1
            Document document = new Document(PageSize.A3);
            // step 2
            String dest_file = DEST_FOLDER + "/device_n_gradient_base.pdf";
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(dest_file, FileMode.Create));
            // step 3
            document.Open();
            // step 4
            PdfContentByte canvas = writer.DirectContent;
            PdfSpotColor psc_gray = new PdfSpotColor("iTextGray", new GrayColor(0f));
            PdfSpotColor psc_cmyk_yell = new PdfSpotColor("iTextYellow", new CMYKColor(0f, 0f, 1f, 0f));
            PdfSpotColor psc_cmyk_magen = new PdfSpotColor("iTextMagenta", new CMYKColor(0f, 1f, 0f, 0f));
            PdfSpotColor psc_rgb_blue = new PdfSpotColor("iTextBlue", new BaseColor(0, 0, 255));

            PdfDeviceNColor pdfDeviceNNChannelColor =
                new PdfDeviceNColor(new PdfSpotColor[] {psc_cmyk_yell, psc_cmyk_magen, psc_rgb_blue});
            PdfDeviceNColor pdfDeviceNNChannelColor2 =
                new PdfDeviceNColor(new PdfSpotColor[] {psc_cmyk_magen, psc_cmyk_yell, psc_rgb_blue});

            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("iTextGray", new GrayColor(0f)), 0.8f), 36, 824, 36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("iTextYellow", new CMYKColor(0f, 0f, 1f, 0f)), 0.8f), 90, 824,
                36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("iTextMagenta", new CMYKColor(0f, 1f, 0f, 0f)), 0.4f), 144, 824,
                36, 36);
            ColorRectangle(canvas, new SpotColor(new PdfSpotColor("iTextBlue", new BaseColor(0, 0, 255)), 0.7f), 198, 824, 36, 36);

            ColorRectangle(canvas,
                new DeviceNColor(new PdfDeviceNColor(new PdfSpotColor[] {psc_cmyk_yell, psc_cmyk_magen, psc_rgb_blue}),
                    new float[] {0, 0.0f, 1}), 36, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0.1f, 0.1f, 1}), 90, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0.2f, 0.2f, 1}), 144, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0.3f, 0.3f, 1}), 198, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0.4f, 0.4f, 1}), 252, 770, 36, 36);
            ColorRectangle(canvas,
                new DeviceNColor(new PdfDeviceNColor(new PdfSpotColor[] {psc_cmyk_yell, psc_cmyk_magen, psc_rgb_blue, psc_gray}),
                    new float[] {0.5f, 0.5f, 1, 0.5f}), 306, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor2, new float[] {0.6f, 0.1f, 1}), 360, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0.7f, 0.7f, 1}), 416, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0.8f, 0.8f, 1}), 470, 770, 36, 36);
            ColorRectangle(canvas,
                new DeviceNColor(new PdfDeviceNColor(new PdfSpotColor[] {psc_cmyk_yell, psc_cmyk_magen, psc_rgb_blue}),
                    new float[] {0.9f, 0.9f, 1}), 524, 770, 36, 36);
            ColorRectangle(canvas, new DeviceNColor(pdfDeviceNNChannelColor, new float[] {1, 1, 1}), 578, 770, 36, 36);

            PdfDeviceNColor pdfDeviceNColor = new PdfDeviceNColor(new PdfSpotColor[] {psc_cmyk_yell, psc_cmyk_magen, psc_rgb_blue});
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0, 0, 1}));
            canvas.Rectangle(36, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.1f, 0.1f, 1}));
            canvas.Rectangle(90, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.2f, 0.2f, 1}));
            canvas.Rectangle(144, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.3f, 0.3f, 1}));
            canvas.Rectangle(198, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.4f, 0.4f, 1}));
            canvas.Rectangle(252, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.5f, 0.5f, 1}));
            canvas.Rectangle(306, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.6f, 0.1f, 1}));
            canvas.Rectangle(360, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.7f, 0.7f, 1}));
            canvas.Rectangle(416, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.8f, 0.8f, 1}));
            canvas.Rectangle(470, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {0.9f, 0.9f, 1}));
            canvas.Rectangle(524, 716, 36, 36);
            canvas.FillStroke();
            canvas.SetColorFill(new DeviceNColor(pdfDeviceNColor, new float[] {1, 1, 1}));
            canvas.Rectangle(578, 716, 36, 36);
            canvas.FillStroke();

            canvas.SaveState();
            canvas.Rectangle(418, 412, -329, 189);
            canvas.Clip();
            canvas.NewPath();
            canvas.SaveState();
            canvas.ConcatCTM(329f, 0f, 0f, -329f, 89f, 506.5f);
            canvas.PaintShading(PdfShading.SimpleAxial(writer, 0, 0, 1, 0,
                new DeviceNColor(pdfDeviceNNChannelColor, new float[] {1, 1, 0}),
                new DeviceNColor(pdfDeviceNNChannelColor, new float[] {0, 0, 1})));
            canvas.RestoreState();
            canvas.RestoreState();
            canvas.SetColorStroke(new DeviceNColor(pdfDeviceNNChannelColor, new float[] {1, 1, 1}));
            canvas.Rectangle(418, 412, -329, 189);
            canvas.Stroke();

            // step 5
            document.Close();

            CompareTool compareTool = new CompareTool();
            String error = compareTool.Compare(dest_file, TEST_RESOURCES_PATH + "cmp_device_n_gradient_base.pdf", DEST_FOLDER, "diff_");
//.........这里部分代码省略.........
开发者ID:newlysoft,项目名称:itextsharp,代码行数:101,代码来源:DeviceNColorSpaceTest.cs

示例5: DeviceNCmykRedRgbBlueGradient

        public virtual void DeviceNCmykRedRgbBlueGradient() {
            Document document = new Document();
            // step 2
            String dest_file = DEST_FOLDER + "/device_n_gradient_CmykRedRgbBlue.pdf";
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(dest_file, FileMode.Create));
            // step 3
            document.Open();
            // step 4
            PdfContentByte canvas = writer.DirectContent;
            PdfSpotColor psc_red = new PdfSpotColor("Spot Red", new CMYKColor(0f, 1f, 1f, 0f));
            PdfSpotColor psc_blue = new PdfSpotColor("Spot Blue", new BaseColor(0, 0, 255));
            PdfDeviceNColor deviceNColor = new PdfDeviceNColor(new PdfSpotColor[] {psc_red, psc_blue});

            canvas.SaveState();
            canvas.Rectangle(418, 412, -329, 189);
            canvas.Clip();
            canvas.NewPath();
            canvas.SaveState();
            canvas.ConcatCTM(329f, 0f, 0f, -329f, 89f, 506.5f);
            canvas.PaintShading(PdfShading.SimpleAxial(writer, 0, 0, 1, 0, new DeviceNColor(deviceNColor, new float[] {1, 0}),
                new DeviceNColor(deviceNColor, new float[] {0, 1})));
            canvas.RestoreState();
            canvas.RestoreState();
            canvas.SetCMYKColorStroke(0, 0, 0, 0xFF);
            canvas.Rectangle(418, 412, -329, 189);
            canvas.Stroke();
            document.Close();

            CompareTool compareTool = new CompareTool();
            String error = compareTool.Compare(dest_file, TEST_RESOURCES_PATH + "cmp_device_n_gradient_CmykRedRgbBlue.pdf", DEST_FOLDER, "diff_");
            if (error != null) {
                Assert.Fail(error);
            }
        }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:34,代码来源:DeviceNColorSpaceTest.cs

示例6: TestFlatteningGenerateAppearances1

        public virtual void TestFlatteningGenerateAppearances1()
        {

            Directory.CreateDirectory(OUTPUT_FOLDER);

            const string OUT = "noappearances-needapp-false_override-false.pdf";
            TestFlatteningGenerateAppearance(RESOURCES_FOLDER + "noappearances-needapp-false.pdf", OUTPUT_FOLDER + OUT, false);

            CompareTool compareTool = new CompareTool();
            String errorMessage = compareTool.Compare(OUTPUT_FOLDER + OUT, RESOURCES_FOLDER + "cmp_" + OUT, OUTPUT_FOLDER, "diff");
            if (errorMessage != null)
            {
                Assert.Fail(errorMessage);
            }
        }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:15,代码来源:FlatteningTest.cs

示例7: ComparePdf

        /// <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);
        }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:27,代码来源:GenericTest.cs

示例8: Compare

        private void Compare(String outPdf, String cmpPdf) {
            CompareTool ct = new CompareTool(outPdf, cmpPdf);
            Assert.IsNull(ct.Compare(OUT_FOLDER, "difference"));

            String outXml = Path.GetFileNameWithoutExtension(outPdf);
            String cmpXml = Path.GetFileNameWithoutExtension(cmpPdf);

            outXml = OUT_FOLDER + outXml.Replace(".pdf", "") + ".xml";
            cmpXml = OUT_FOLDER + "cmp_" + cmpXml.Replace("cmp_", "").Replace(".pdf", "") + ".xml";
            
            PdfReader reader = new PdfReader(outPdf);
            new MyTaggedPdfReaderTool().ConvertToXml(reader, new FileStream(outXml, FileMode.Create));
            reader.Close();

            reader = new PdfReader(outPdf);
            new MyTaggedPdfReaderTool().ConvertToXml(reader, new FileStream(cmpXml, FileMode.Create));
            reader.Close();

            XmlDiff xmldiff = new XmlDiff(XmlDiffOptions.None);
            Assert.True(xmldiff.Compare(cmpXml, outXml, false));
        }
开发者ID:smartleos,项目名称:itextsharp,代码行数:21,代码来源:AcroFieldsFlattenTest.cs


注:本文中的CompareTool.Compare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。