如何在m子中检查空白pdf?

时间:2019-04-02 06:51:10

标签: java pdf mule mule-esb

我有一种情况,我必须检查从Web服务接收的pdf是否为空白pdf,如果pdf为空白,则在mule api中返回适当的错误响应。

我该如何实现?

谢谢

1 个答案:

答案 0 :(得分:0)

如果内容始终相同

import re

with open('eng.txt', 'r') as f:
    s = f.read()
s_copy = s

punctuation = [".","\"",",","-","(",")","[","]"]

pattern = re.compile("\\b("+"|".join(punctuation)+")\\W", re.I)
s_copy = pattern.sub(" ", s_copy)
s_copy = s_copy.replace("\"","")
s_words = s_copy.split(" ")

with open('vocab30000.txt', 'r') as f:
    check_words = f.read()

remove_words = list(set(s_words) - set(check_words))

pattern = re.compile("\\b("+"|".join(remove_words[1:])+")\\W", re.I)
pattern.sub("", s)

如何获得byte[] sampleBytes = Files.readAllBytes(sample); byte[] incommingBytes = Files.readAllBytes(incommingPdf); if(f1.equals(f2){ domeSomeThing.. } 是您的生意,只需检查它们的平等性即可。

Check two Files