- Home
- Forum
- Xamarin.Forms
- app crash when open file pdf convert from doc
app crash when open file pdf convert from doc
app crash when open file pdf convert from doc
Attachment: ViewFileByID2_4721b8c6.rar
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
SIGN IN To post a reply.
1 Reply
GR
Gayathri Ramalingam
Syncfusion Team
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
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
DP DUNG PHAM VAN
- Apr 7, 2019 06:32 AM UTC
- Apr 8, 2019 11:22 AM UTC