我在Windows Store應用程序項目中使用PDFTron PDF註記庫。有時,當我試圖將以前完成的註釋(保存爲單獨的文件)加載到PDFView控件中時,它會引發AccessViolationException。 請幫忙。爲什麼PDFTron PDFViewCtrl.Update()拋出AccessViolationException
在我的網頁,這是代碼:
await ImportAnnotations(param.Doc, agendaItem);
this.PDFViewCtrl.Update(); //this is where the exception throws
這是ImportAnnotations功能。
private async Task<PDFDoc> ImportAnnotations(PDFDoc doc, AgendaItem GlobalSelectdAgendaItem)
{
try
{
if (doc != null && GlobalSelectdAgendaItem != null)
{
StorageFolder documentsFolder = await StorageFolder.GetFolderFromPathAsync(Path.Combine(ApplicationData.Current.LocalFolder.Path, Global.UserId.ToString(), ApplicationConstants.PDF));
string annotationFileName = GlobalSelectdAgendaItem.ID + "_" + Global.UserId.ToString() + "_" + GlobalSelectdAgendaItem.VersionId + ".xfdf";
// load XFDF annotations
var anntotationFile = await documentsFolder.TryGetItemAsync(annotationFileName) as IStorageFile;
FDFDoc fdfDoc = null;
if (anntotationFile != null)
{
fdfDoc = await FDFDoc.CreateFromXFDFAsync(Path.Combine(documentsFolder.Path, annotationFileName));
}
else
{
return doc;
}
// load PDF with which to merge the annotations
doc.InitSecurityHandler();
// merge in the annotations
doc.FDFMerge(fdfDoc);
doc.RefreshFieldAppearances();
}
}
catch (Exception)
{
}
return doc;
}
什麼異常調用堆棧完成你ImportAnnotations功能? – Matt
消息:{「嘗試讀取或寫入受保護的內存,這通常表示其他內存已損壞。」} – SurenSaluka
這是異常消息,不是調用堆棧。 – Matt