logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Terry  
#1 Posted : Monday, July 3, 2017 7:15:49 AM(UTC)
Terry

Rank: Member

Groups: Registered
Joined: 7/26/2016(UTC)
Posts: 25
United Kingdom
Location: Somerset

Thanks: 5 times
Hi,

What is the correct way to completely remove an indirect object from a PDF?

My specific problem is that I have an AcroForm field dictionary that contains an entry with key 'Metadata' which is an indirect stream object. However, I can find no way to delete the object so that it is completely removed from the PDF.

If the field dictionary is 'fieldDictionary', I can get the value of the 'Metadata' key with:

PdfTypeIndirect metadataObj = fieldDictionary.GetBy("Metadata") as PdfTypeIndirect;

I have tried calling:

metadataObj.Release();
metadataObj.Direct.Release();
PdfIndirectList.FromPdfDocument(pdfDoc).Remove(metadataObj.ObjectNumber);
fieldDictionary.Remove("Metadata");

and variations of the above, but nothing seems to work. When I save the PDF and look at its contents in a text editor the metadata object is always still present as an 'orphaned' unreferenced object. For our application we need to completely remove the object even though it is not referenced by any other object in the PDF.

Any help would be greatly appreciated. Thanks.

Regards,
Terry.
Paul Rayman  
#2 Posted : Monday, July 3, 2017 9:05:39 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Originally Posted by: Terry Go to Quoted Post
When I save the PDF and look at its contents in a text editor the metadata object is always still present as an 'orphaned' unreferenced object.


Do you save it with NoIncrement flag?

Could you please provide that pdf file and point me what I should delete and how I can check result?
Terry  
#3 Posted : Wednesday, July 5, 2017 2:39:15 AM(UTC)
Terry

Rank: Member

Groups: Registered
Joined: 7/26/2016(UTC)
Posts: 25
United Kingdom
Location: Somerset

Thanks: 5 times
Hi Paul,

Thanks for your reply.

Yes, I do save the PDF with the ‘NoIncremental’ flag.

I am just sending you an email with an example PDF attached and more details of the problem.

Many thanks for your help.

Best regards,
Terry.
Paul Rayman  
#4 Posted : Sunday, July 16, 2017 4:59:09 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Please find new Version here
http://forum.patagames.c...released-on-Jul-16--2017

You can use PdfCrossReferenceTable to delete unwanted objects from PDF files.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.