Unplanned
Last Updated: 02 May 2020 08:49 by ADMIN
David
Created on: 14 Feb 2020 10:43
Category: PdfViewer
Type: Bug Report
3
PdfViewer: Glyph "middot" data cannot be found in Type1Font
Pdf document is not loaded when it contains Type1Font "middot" glyph.
6 comments
ADMIN
Didi
Posted on: 02 May 2020 08:49

Hi Gerald,

Regarding to the error message, as I explained the option is using SourceException event. 

At this time I cannot commit a time frame when a fix for this issue will be provided. Follow the feedback item, so you will be notified when its status changes. 

Regards,
Didi
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Gerald
Posted on: 01 May 2020 16:23
I'm getting the exception now. I wasn't getting it on a previous version,  thank you.  Is there any way to know before I try to show it? Are you guys providing a fix? If it helps, pdfjs is able to display these files.
Gerald
Posted on: 01 May 2020 12:35

That event does not get hit for the pdfs that do not render. Just get a blank page

        private void PdfViewer_SourceException(object sender, SourceExceptionEventArgs e)
        {
            e.Exception.DebugLog("PdfViewer", this.pdfViewer.Source);
        }
ADMIN
Didi
Posted on: 01 May 2020 10:12

Hello,

RadPdfViewer provides a way to catch these cases through its SourceException event. In addition, you could show a user-friendly message to the users through SourceExceptionTemplate.

Example: 

PdfViewer definition:

 <Grid>
        <pdfviewer:RadPdfViewer x:Name="pdfViewer" SourceException="pdfViewer_SourceException"/>
</Grid>
code behind: 
Func<CancellationToken, Task<Stream>> streamFunc = ct => Task.Run(() =>
    {
        Assembly assembly = typeof(MainPage).Assembly;
        string fileName = assembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("PDFNAME.pdf"));
        Stream stream = assembly.GetManifestResourceStream(fileName);
        return stream;
    });
    this.pdfViewer.Source = streamFunc;

and the SourceException event handler definition:

public void pdfViewer_SourceException(object sender, SourceExceptionEventArgs e)
{
    var error = e.Exception.Message;
    Device.BeginInvokeOnMainThread(()=> {
        Application.Current.MainPage.DisplayAlert("Error", error, "OK");
    });
}

The exception message is as follow: 

System.Collections.Generic.KeyNotFoundException: The given key 'middot' was not present in the dictionary.  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e]

 

For more details on PdfViewer SourceException event please check the following link form our help article: https://docs.telerik.com/devtools/xamarin/controls/pdfviewer/pdfviewer-sourceexception

Regards,
Didi
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Vasile
Posted on: 30 Apr 2020 23:30
Can we see an example of what such .pdf document containing Type1Font "middot" glyph would look like, so we know if we have a similar case? In case  of .pdf files resulting from scanning paper forms, there is no easy way tell what fonts were embedded on the scanned document.
Gerald
Posted on: 30 Apr 2020 22:19
Is there a way to atleast give that feedback to the user. The error event shows nothing.