We have a ton of pdf documents that each have links that open other pdf documents. When clicking on the links it will open up the other pdf document in the same file system. The problem is that we need to change the name of some of the directories which will require the changing of all the links that point to pdf documents in that directory. We would do this manually but there are literally thousands of links that need to be alter.
We have tried to use iTextSharp and PdfSharp to alter the links but are having a difficult time getting to the right object. Below shows the contents of a sample pdf file with two links. You can see that object 12 is a link that references object 21 and object 21 opens a new window using the reference in object 20. Object 20, of type Filespec contains the path to the linked pdf, Folder-Name/A.pdf. The second link follows the same pattern but uses objects 16, 23, and 22.
12 0 obj<</Type/Annot/P 5 0 R/F 4/C[1 0 0]/Subtype/Link/A 21 0 R/M(D:20130710103035-07'00')/Border[0 0 0]/Rect[144 612 216 630]/NM(QVDTKWKAZGVAAGHJ)/BS 13 0 R>>
endobj
13 0 obj<</W 0/S/S/Type/Border>>
endobj
16 0 obj<</Type/Annot/P 5 0 R/F 4/C[1 0 0]/Subtype/Link/A 23 0 R/M(D:20130710103040-07'00')/Border[0 0 0]/Rect[126 594 216 612]/NM(WFAYQFGTTIESQOKW)/BS 17 0 R>>
endobj
17 0 obj<</W 0/S/S/Type/Border>>
endobj
20 0 obj<</Type/Filespec/F(Folder-Name/A.pdf)/UF(Folder-Name/A.pdf)/Desc()>>
endobj
21 0 obj<</S/GoToR/D[0/Fit]/NewWindow true/F 20 0 R>>
endobj
22 0 obj<</Type/Filespec/F(Folder-Name-2/B.pdf)/UF(Folder-Name-2/B.pdf)/Desc()>>
endobj
23 0 obj<</S/GoToR/D[0/Fit]/NewWindow true/F 22 0 R>>
endobj
How can we use iTextSharp or PdfSharp to change "Folder-Name" and "Folder-Name-2" to some other arbitrary folder path?