Deleting metadata automatically?

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Puffolino
User
Posts: 337
Joined: Wed Feb 09, 2011 1:06 pm

Deleting metadata automatically?

Post by Puffolino »

I was wondering how much metadata is present in certain documents, and thought cleaning it up would be an easy job...

* save as optimized does only "Discard document information and metadata" together

* doing a script (which still needs to be started manually :() has some effects I do not understand
for instance, the following code does change the document information only (the metadata will be kept):

Code: Select all

var pp = app.activeDocs[i].info;
	pp.keywords="";
...but the following code does change the document information and the metadata:

Code: Select all

var pp = app.activeDocs[i].info;
	pp.keywords="***";
Does anyone know hot to easily remove unneeded metadata sections from hundreds of PDF files without changing the document information?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19924
Joined: Mon Jan 12, 2009 8:07 am

Re: Deleting metadata automatically?

Post by Stefan - PDF-XChange »

Hello Puffolino,

Maybe you can achieve that with PDF Tools?
You can use the "Sanitize Document" in tools - and then input hundreds of files to be processed at the same time!

Kind regards,
Stefan
Puffolino
User
Posts: 337
Joined: Wed Feb 09, 2011 1:06 pm

Re: Deleting metadata automatically?

Post by Puffolino »

Thanks,
tried to do so, but PC Tools just allow to kill the complete meta information (which also removes data for title, subject, author, etc.)

So the scripting method seems to be more useful, anyhow assigning a null string seems to be ignored (see example in the first post) and I didn't find how to access different metadata sections in a file.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12152
Joined: Wed Jan 03, 2018 6:52 pm

Re: Deleting metadata automatically?

Post by Daniel - PDF-XChange »

Hello, Puffolino

Could I ask for some clarification on what you mean to be the difference between "the document information and the metadata"?

Also, if you are looking for help with JS commands that can be used un PDF documents, you may want to take a look here: https://opensource.adobe.com/dc-acrobat ... apiref.pdf

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Puffolino
User
Posts: 337
Joined: Wed Feb 09, 2011 1:06 pm

Re: Deleting metadata automatically?

Post by Puffolino »

Hi Daniel,

when I wrote 'document information' I ment the data which is seen within the document properties (description page, section document info): Title, Author, Subject,...
This is also metadata and is displayed when choosing the button "Additional Metadata" at the description page, so I was thinking it would not be seen on the page 'Advanced' (which I have called metadata) then. Hopyfully now it is not more confusing than before.

Anyhow, this dialog window could confuse other users as well, some examples:
- elements of the description page reappear with the advanced page, maybe thesre is a possibility to make this more clear (tooltips, text colors, tags, etc.)
- the 'Delete' button in the XMP structure does not change to a disabled state when no element is selected
- the 'Remove All' (why not 'Delete All'?) does not clear the 'Document Info' in the 'Document Properties' window (that's why I thought document information and metadata are different things)

Actually I did not find a way to reduce the metadata to a minimum (the document title) to reduce the PDF size automatically:
- using Javascript does not allow to remove the elements like the keywords by assigning a nil string (seems to be a bug for me)
- using PDF Tool's Sanitize is cool, but only if you want to remove ALL information. As soon you want to add a document title (by using PDF Tools document properties function), the metadata gets bigger than before

But there is a possibility to do the trick manually using the Editor: document properties / advanced metdata / advanced / remove all / ok / adding and removing a space to the displayed document title / ok.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19924
Joined: Mon Jan 12, 2009 8:07 am

Re: Deleting metadata automatically?

Post by Stefan - PDF-XChange »

Hello Puffolino,

Thanks for the clarification.
I will discuss the above with Dan and we will bring it up to the devs' attention if needed to e.g. clarify some of the wording we use.

As for deleting the keywords/document title - are you looking at extreme file optimization? I do not expect this info to add more than a few KBs to a file's size - so you likely need those very small files for a specific use case?

Kind regards,
Stefan
Puffolino
User
Posts: 337
Joined: Wed Feb 09, 2011 1:06 pm

Re: Deleting metadata automatically?

Post by Puffolino »

Hi, just wanted to give you a hint about the issue that the 'Document Information' in the 'Document Properties' dialog will not be updated (cleared), when all metadata is removed ('Additional Metadata...' / 'Advanced' / 'Remove All' / 'Ok')

:roll:
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12152
Joined: Wed Jan 03, 2018 6:52 pm

Re: Deleting metadata automatically?

Post by Daniel - PDF-XChange »

Hello, Puffolino

That is expected, you are only removing the "additional metadata", not the primary aspects that are present in most every document. If you need to remove those, you can use the save as optimized function, to remove all metadata:
PDFXEdit_nLlOHmJNKF.gif
Kind regards,
You do not have the required permissions to view the files attached to this post.
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Puffolino
User
Posts: 337
Joined: Wed Feb 09, 2011 1:06 pm

Re: Deleting metadata automatically?

Post by Puffolino »

1. Ctr+D (Document information is seen)
#1#.png
2. Button 'Additional Metadata...'
#2#.png
3. Advanced
#3#.png
4. Remove all
#4#.png
5. Ok (All information should be cleared now but is still here -> Bug)
#5#.png
6. After closing the panel and reopen it (Ctrl+D) the information is gone (which is correct)
#6#.png
You do not have the required permissions to view the files attached to this post.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12152
Joined: Wed Jan 03, 2018 6:52 pm

Re: Deleting metadata automatically?

Post by Daniel - PDF-XChange »

Hello, Puffolino

I see, so the bug here is purely visual in nature and disappears upon closing and re-opening the properties window. I will admit that because of this bug, I misconstrued the intent of this function, so there is definitely some merit to the complaint. I will pass that to the Dev team for review, but as a purely visual issue, I cannot promise it will be given a high priority.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com