简体   繁体   English

java.lang.IllegalArgumentException:地图大小(0)必须> = 1

[英]java.lang.IllegalArgumentException: Map size (0) must be >= 1

I have written a Java program that deals with PDF's and at the end it runs the following code to optimize the file size of the PDF's that were created. 我编写了一个处理PDF的Java程序,最后它运行以下代码来优化所创建PDF的文件大小。

log.debug("Optimizing the PDF");
OptimizationOptions opt = new Document.OptimizationOptions();
opt.setRemoveUnusedObjects(true);
opt.setRemoveUnusedStreams(true);
opt.setLinkDuplcateStreams(true);
opt.setCompressImages(true);
opt.setImageQuality (90);
pdfDocument.optimizeResources(opt);

It works most of the time but recently it threw the following error java.lang.IllegalArgumentException: Map size (0) must be >= 1. I have not been able to replicate the error so I am unsure as to which line of code is throwing the error however my guess would be 它在大多数时间都有效,但是最近它引发了以下错误java.lang.IllegalArgumentException:地图大小(0)必须大于等于1。我无法复制该错误,因此我不确定哪一行代码是抛出错误,但是我的猜测是

pdfDocument.optimizeResources(opt);

My question is what are some of the possible causes for this error I have not been able to find any good information on this. 我的问题是导致此错误的一些可能原因是什么,我至今仍无法找到任何好的信息。 I would also appreciate any links as well as any suggestions that are given. 我也将不胜感激任何链接以及给出的任何建议。

Most probably, this error is caused by some specific document(s). 此错误很可能是由某些特定文档引起的。 The best solution is to 最好的解决方案是

  1. First find out which document caused this issue. 首先找出导致此问题的文档。
  2. Then report the issue in Aspose forums with the test file that caused this issue. 然后在Aspose论坛中用引起该问题的测试文件报告该问题。

Well after a lot more tests it definitely has something to do with the size of the PDF's. 在经过更多测试之后,它肯定与PDF的大小有关。 The code works perfect with any normal size PDF it's the ones that start getting to the 1000's of pages that crash. 该代码可与任何正常大小的PDF完美配合,因为它可以开始崩溃的1000多个页面。 I don't know if it's a time out issue or something else with how Aspose handles it but I will be escalating this to Aspose. 我不知道这是超时问题还是Aspose处理该问题的其他方式,但我会将其升级为Aspose。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM