Completed
Last Updated: 07 Feb 2022 13:57 by ADMIN
Release R1 2022 SP1
Gregory
Created on: 21 Jan 2022 10:55
Category: PdfProcessing
Type: Feature Request
0
PdfProcessing: UriFormatException is thrown when merging/cloning a document containing UriAction with invalid URI

URI Action with invalid mailto URL scheme - mailto:***@***.**(E-mail) can be imported but trying to merge or clone the document throws UriFormatException: 'Invalid URI: The hostname could not be parsed.'

Workaround: Remove the annotations that contain invalid Uri:

PdfFormatProvider provider = new PdfFormatProvider();
this.pdfDocument = provider.Import(memory);

foreach (var page in this.pdfDocument.Pages.ToList())
{
    List<Link> links = page.Annotations.Where(a => a.Type == AnnotationType.Link).Select(a => a as Link).ToList();
    foreach (var link in links)
    {
        Uri uri;
        UriAction uriAction = link.Action as UriAction;

        try
        {
            uri = uriAction.Uri;
        }
        catch (UriFormatException)
        {
            page.Annotations.Remove(link);
        }
    }
}

1 comment
ADMIN
Peshito
Posted on: 07 Feb 2022 13:57

Hello,

This item will be available in R1 2022 SP1 Release. 

It is also available with Telerik UI for WPF's latest internal build - LIB 2022.2.207 (09 Feb 2022) if you need it earlier. 

Regards,
Peshito
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.