我从 jasper 生成两个 PDF,将相同的参数传递给它们,当我对这两个 PDF 进行哈希处理时,它们的哈希值不同,我认为这是正确的结果,因为它们具有相同的内容,它们是在不同时间创建的。但是当我将这两个 PDF 转换为 PDF/A 时,它们的 sha1 哈希值是相等的。
有人可以帮我解决这个问题吗?这怎么可能?
编辑:
private static final String OUTPUT_FORMAT = "fi_pdfa";
public void convert(String exeFullPath, String inputFile,
String outputFile, String fontDirectory) {
String[] execParams = new String[4];
execParams[0] = exeFullPath;
execParams[1] = "\"inputpath_u=" + base64Encode(inputFile) + "\"";
execParams[2] = "\"outputpath_u=" + base64Encode(outputFile) + "\"";
execParams[3] = "\"outputid=" + OUTPUT_FORMAT + "\"";
// execParams[1] = "inputpath_u=\"" + base64Encode(inputFile) + "\"";
// execParams[2] = "outputpath_u=\"" + base64Encode(outputFile) + "\"";
// execParams[3] = "outputid=" + OUTPUT_FORMAT;
// execParams[4] = "fontdirectory=\"" + fontDirectory + "\"";
Runtime runtime = Runtime.getRuntime();
Process process = null;
ExportStatusCode statusCode = null;
ExportShutdownHook shutdownHook = null;
try {
process = runtime.exec(execParams);
// Install a shutdown hook to perform cleanup if we're interrupted.
shutdownHook = new ExportShutdownHook(process);
runtime.addShutdownHook(shutdownHook);
process.waitFor();
InputStream is = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = reader.readLine()) != null)
System.out.println(line);
reader.close();
runtime.removeShutdownHook(shutdownHook);
shutdownHook.finished();
statusCode = new ExportStatusCode(process.exitValue());
} catch (IOException ex) {
log.error(ex);
if (shutdownHook != null) {
runtime.removeShutdownHook(shutdownHook);
shutdownHook.finished();
}
statusCode = ExportStatusCode.SCCERR_JAVA_IO_ERROR;
} catch (InterruptedException ex) {
log.error(ex);
runtime.removeShutdownHook(shutdownHook);
shutdownHook.finished();
process.destroy();
statusCode = ExportStatusCode.SCCERR_JAVA_INTERRUPTED;
}
}