Clear Filters
Clear Filters

How shall I resolve the warning of Merging of Pdfs?

5 views (last 30 days)
I have been trying to merge pdfs. With this function, I am able to merge the pdfs, however , it throws warning. "[WARN] PDFMergerUtility - Removed /IDTree from /Names dictionary, doesn't belong there". Please let me know, the steps to resolve.
MergePdf Link: MergePDF

Accepted Answer

MarKf
MarKf on 5 Apr 2023
Edited: MarKf on 5 Apr 2023
Nice little utility (and overall apache pdfbox functionality), I just tried it, it worked and it didn't even give me an error (because I don't have IDTrees in the pdfs I guess).
Anyway whenever there is a warning that one needs to suppress (like while in loop for example) you can get the warning identifier and shut it. However that might be more tricky for these internal functions maybe lacking identifiers. Try:
% [mwarn, mwarnid] = lastwarn; %to get id of warning thrown by process
wrn = warning('off',mwarnid); %like 'stats:statrobustfit:IterationLimit' or 'MATLAB:DELETE:FileNotFound'
% code
warning(wrn) %reset previous warning state
  3 Comments
MarKf
MarKf on 6 Apr 2023
Edited: MarKf on 6 Apr 2023
Can you get the ID with [mwarn, mwarnid] = lastwarn; after getting 1 instance of the warning? You have to substitute it in the second line of the code above (mwarnid that is) then. Is the warning issued/handled with the warning function (are the warnings in orange)? In that canse you could also just suppress all warnings (with wrn=warning('off') and then reset the previous warning state as above or with warning('on') as well). Otherwise if it is just displayed in an inner-workings way then you'd have to delve deeper, which I'd suggest against if you cannot make the code above work. Also consider accepting the answer if that's what you were looking for or if it helped.
MarKf
MarKf on 6 Apr 2023
I mean it's java stuff... You could try adding merger.setIgnoreAcroFormErrors(true) in the code of MergePDF above. You could also delete the IDtrees of both pdfs since you are likely not interested in keeping them and they are what's causing the issue, using the same utility (pdfbox). I'd say disabling the warnings is your safest bet.

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!