How shall I resolve the warning of Merging of Pdfs?

2 visualizaciones (últimos 30 días)
Montina
Montina el 5 de Abr. de 2023
Comentada: MarKf el 6 de Abr. de 2023
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

Respuesta aceptada

MarKf
MarKf el 5 de Abr. de 2023
Editada: MarKf el 5 de Abr. de 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 comentarios
MarKf
MarKf el 6 de Abr. de 2023
Editada: MarKf el 6 de Abr. de 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 el 6 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by