在我的UWP项目中,我尝试使用Syncfusion的PDF库填充其中的PDF。为了打开我想使用的模板,我构建了以下代码:
//Browse and chose the file
Windows.Storage.StorageFolder storageFolder
= Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile file
= await storageFolder.GetFileAsync("/Assets/template.pdf");
//Creates an empty PDF loaded document instance
PdfLoadedDocument loadedDocument = new PdfLoadedDocument();
//Loads or opens an existing PDF document through Open method of PdfLoadedDocument class
await loadedDocument.OpenAsync(file);
PDF,template.pdf,位于项目中我的资源库中,并且其属性“复制到输出目录”设置为“始终复制”。
运行此代码将导致以下错误:System.ArgumentException:'值不在预期范围内。
用于此问题的正确语法将是什么?
你可以试试:
var file = await StorageFile.
GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/template.pdf"));
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句