Hi,
I need to remove Hyperlink from PDF document. I used following code. Got nuget package and it works well with water mark Evaluation.
var fileName = @“C:\Workspace\ASPOSE_PDF\Black and White Hyperlink.pdf”;
var document = new Aspose.Pdf.Document(fileName);
// delete annotations on a particular page
document.Pages[1].Annotations.Delete();
If put licesnse file and dll to bin directory and added following code it gives error Could not load file or assembly ‘Aspose.PDF, Version=22.7.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)’
Aspose.Pdf.License license = new Aspose.Pdf.License();
try
{
// Set license
license.SetLicense(“Aspose.PDF.NET.lic”);
}
catch (Exception)
{
// something went wrong
throw;
}
We got the new license 20220427 and Aspose.DLL version 21.8.00
How do we get latest version and license file. Is there anything wrong in implementation
Please help
Mark
@mclement.jud6.org
Please upgrade to the latest version of Aspose.PDF for .NET 22.7 and let us know how it goes on your side. Hope this helps you.
Please read the following article about removing link annotation.
How to delete Link Annotation in PDF Document Using C#
If you still face problem, please share your input PDF and problematic output PDF files here for testing. We will investigate the issue and provide you more information on it.
Hi,
Can I get VB.Net version code for the following
Document document = new Document(System.IO.Path.Combine(_dataDir, “sample_Link.pdf”));
var LinkAnnotations = document.Pages[1].Annotations
.Where(a => a.AnnotationType == AnnotationType.Link)
.Cast();
foreach (var ca in LinkAnnotations)
{
document.Pages[1].Annotations.Delete(ca);
}
document.Save(System.IO.Path.Combine(_dataDir, "sample_Link_del.pdf"));
@mclement.jud6.org
Please check the following VB code example to achieve the same requirement. Hope this helps you.
Dim document As Document = New Document(System.IO.Path.Combine(_dataDir, _, sample_Link.pdf))
Dim LinkAnnotations = document.Pages(1).Annotations.Where(Function(a) a.AnnotationType = AnnotationType.Link).Cast()
For Each ca In LinkAnnotations
document.Pages(1).Annotations.Delete(ca)
Next
document.Save(System.IO.Path.Combine(_dataDir, "sample_Link_del.pdf"))
Thanks for the code. I am having some issues on certain PDF where it does not identify link .
What do you suggest
@mclement.jud6.org
Could you please attach your input, problematic and expected output PDF files here for testing? We will investigate the issue and provide you more information on it.