我想创建一个可以在windows store上读取pdf的应用程序。 pdf可以通过从服务器下载获得,并可以通过应用程序访问。有两种不同密码的pdf类型。免费的pdf使用密码"东"和付费的pdf使用密码" Java"。我有一个问题,付费的pdf无法读取而且只是空的,但是可以阅读的免费pdf。
以下是我从服务器下载后阅读pdf的代码:
async private void LoadFile(string name)
{
StorageFolder installedLocation = ApplicationData.Current.LocalFolder;
StorageFolder koleksibuku = await installedLocation.CreateFolderAsync("library", CreationCollisionOption.OpenIfExists);
IReadOnlyList<StorageFile> files = await koleksibuku.GetFilesAsync();
StorageFolder thumbfolder = await installedLocation.CreateFolderAsync("thumb", CreationCollisionOption.OpenIfExists);
foreach (StorageFile file in files)
{
if (file.DisplayName == name)
{
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
Stream fileStream = stream.AsStreamForRead();
try
{
//free = false;
string password = "East";
pdfViewer.LoadDocument(fileStream, password);
}
catch
{
//free = true;
string password = "Java";
pdfViewer.LoadDocument(fileStream, password);
}
}
请帮助我....