use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class MaskedImagesTest method imageTransparencyTextOnTransparentField.
@Test
public void imageTransparencyTextOnTransparentField() throws IOException, InterruptedException {
String fileName = "textOnTransparentField";
String input = inputPath + fileName + ".pdf";
String output = outputPath + fileName + "_cleaned.pdf";
String cmp = inputPath + "cmp_" + fileName + ".pdf";
List<PdfCleanUpLocation> cleanUpLocations = Collections.singletonList(new PdfCleanUpLocation(1, new Rectangle(280, 360, 200, 75)));
PdfDocument pdfDocument = new PdfDocument(new PdfReader(input), new PdfWriter(output));
PdfCleaner.cleanUp(pdfDocument, cleanUpLocations);
new PdfCanvas(pdfDocument.getFirstPage().newContentStreamBefore(), pdfDocument.getFirstPage().getResources(), pdfDocument).setColor(ColorConstants.LIGHT_GRAY, true).rectangle(0, 0, 1000, 1000).fill().setColor(ColorConstants.BLACK, true);
pdfDocument.close();
Assert.assertNull(new CompareTool().compareByContent(output, cmp, outputPath));
}
use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method compareByContent.
private void compareByContent(String cmp, String output, String targetDir, String diffPrefix) throws IOException, InterruptedException {
CompareTool cmpTool = new CompareTool();
String errorMessage = cmpTool.compareByContent(output, cmp, targetDir, diffPrefix + "_");
if (errorMessage != null) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class PdfCleanUpToolWithInlineImagesTest method compareByContent.
private void compareByContent(String cmp, String output, String targetDir, String diffPrefix) throws IOException, InterruptedException {
CompareTool cmpTool = new CompareTool();
String errorMessage = cmpTool.compareByContent(output, cmp, targetDir, diffPrefix + "_");
if (errorMessage != null) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.kernel.utils.CompareTool in project i7js-highlevel by itext.
the class HighLevelWrapperTest method comparePdf.
@Override
protected void comparePdf(String outPath, String dest, String cmp) throws Exception {
CompareTool compareTool = new CompareTool();
addError(compareTool.compareByContent(dest, cmp, outPath, "diff_"));
addError(compareTool.compareDocumentInfo(dest, cmp));
}
use of com.itextpdf.kernel.utils.CompareTool in project i7js-highlevel by itext.
the class HighLevelWrapperWithEncryptionTest method comparePdf.
@Override
protected void comparePdf(String outPath, String dest, String cmp) throws Exception {
CompareTool compareTool = new CompareTool();
byte[] ownerPass = "abcdefg".getBytes();
compareTool.enableEncryptionCompare();
addError(compareTool.compareByContent(dest, cmp, outPath, "diff_", ownerPass, ownerPass));
addError(compareTool.compareDocumentInfo(dest, cmp, ownerPass, ownerPass));
}
Aggregations