We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

app crash when open file pdf convert from doc

Thread ID:

Created:

Updated:

Platform:

Replies:

143832 Apr 7,2019 06:32 AM UTC Apr 8,2019 11:22 AM UTC Xamarin.Forms 1
loading
Tags: PdfViewer
DUNG PHAM VAN
Asked On April 7, 2019 06:32 AM UTC

app crash when open file pdf convert from doc
 my code get from example:

 internal class GettingStartedViewModel: INotifyPropertyChanged
    {
      
        private Stream m_pdfDocumentStream;

        private string m_documentName;

        string filePath = string.Empty;

        public event PropertyChangedEventHandler PropertyChanged;

        public string DocumentName
        {
            get
            {
                return m_documentName;
            }
            set
            {
                m_documentName = value;
                //Getdata();
                //////PdfDocumentStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream(filePath + "Assets.57a3e4dd-3b40-4665-b55a-4b7419d08db6.pdf");
            }
        }

        private async Task<Stream> DownloadPdfStream(string URL)
        {
            HttpClient httpClient = new HttpClient();
            HttpResponseMessage response = await httpClient.GetAsync(URL);
            //Check whether redirection is needed
            if ((int)response.StatusCode == 302)
            {
                //The URL to redirect is in the header location of the response message
                HttpResponseMessage redirectedResponse = await httpClient.GetAsync(response.Headers.Location.AbsoluteUri);
                return await redirectedResponse.Content.ReadAsStreamAsync();
            }
            return await response.Content.ReadAsStreamAsync();
        }
        public async void Getdata()
        {
            PdfDocumentStream= await DownloadPdfStream("http://10.1.3.202/EofficeFileAPI/FIleDownload/57a3e4dd-3b40-4665-b55a-4b7419d08db6.pdf");
        }
        public GettingStartedViewModel()
        {
            Getdata();
#if COMMONSB
            filePath = "SampleBrowser.Samples.PdfViewer.Samples.";

#else
            filePath = "SampleBrowser.SfPdfViewer.";
           
#endif
        }
        public Stream PdfDocumentStream
        {
            get
            {
                return m_pdfDocumentStream;
            }
            set
            {
                m_pdfDocumentStream = value;
                NotifyPropertyChanged("PdfDocumentStream");

            }
        }
        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private bool CanExecute(object parameter)
        {
            return true;
        }
    }



Attachment: ViewFileByID2_4721b8c6.rar

Gayathri Ramalingam [Syncfusion]
Replied On April 8, 2019 11:22 AM UTC

Hi Dung, 

We were able to reproduce the issue “Null reference exception thrown while loading particular PDF document." in our side and we suspect this to be a defect. We have forwarded this issue to our development team for further analysis and we will update further details by 10-April-2019. 
 
With Regards, 
Gayathri R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon