PdfPig
PdfPig copied to clipboard
Ability to update hyperlinks and annotations
I'd like the ability to update hyperlinks and annotations within a PdfDocument.
For example, given a hyperlink which points to an external resource, I want to change the hyperlink to point to a specific page within the same PDF instead.
Thank you.
using (var document = PdfDocument.Open(pdfFilePath))
{
foreach (var page in document.GetPages())
{
var annotations = page.ExperimentalAccess.GetAnnotations();
foreach (var annotation in annotations)
{
if (annotation.Uri == "file:///C:/Page2.html") // pseudo code
{
annotation.Uri = "Go To Page 2"; // pseudo code
}
}
}
document.Save(); // pseudo code
}
This isn't currently possible because it's only possible to create new documents rather than edit existing ones but there's an issue related to allowing editing #27 . I'll keep this issue open since it's part of the broader feature request.
@icnocop do you found a solution ?