Concatenate tagged PDF files using the older version iText 4.2.0

我的未来我决定 提交于 2020-01-06 05:30:11

问题


I am maintaining the code which is using older version iText 4.2. Now, I am trying to merging multiple tagged PDF files into one using following codes:

Document document = new Document();
PdfCopy copy = new PdfCopy(document, new FileOutputStream(RESULT));
document.open();
PdfReader reader;
int n;
for (int i = 0; i < files.length; i++) {
    reader = new PdfReader(files[i]);
    n = reader.getNumberOfPages();
    for (int page = 0; page < n; ) {
        copy.addPage(copy.getImportedPage(reader, ++page));
    }
    copy.freeReader(reader);
    reader.close();
}
document.close();

However, the tags are not copied over at all. since this is old version, I cannot find the function getImportedPage(reader, ++page, true) with third boolean parameter.

My question is whether the version of itext is not possible to achieve this? I also want to let you know I cannot upgrade my itext version to newer ones.

Thanks for any help!

来源:https://stackoverflow.com/questions/47892830/concatenate-tagged-pdf-files-using-the-older-version-itext-4-2-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!