【发布时间】:2019-05-14 21:04:17
【问题描述】:
我正在使用 Syncfusion 和 Xamarin Forms 动态创建 PDF。在 iOS 中一切正常,但在 Android 中,它无法找到图像(徽标)。
跟随 syncfusion PDF 开始,但即使它不起作用。图片位于 android 的资源/drawable 中。我确实也在资产中添加了它。
这是 xamarin 表单 iOS 中的工作代码
//Load the image
Stream imageStream = System.IO.File.OpenRead("logo.jpg");
//Load the image from the stream
PdfBitmap image = new PdfBitmap(imageStream);
不幸的是,即使这在 Android 上也不起作用
//Load the image
Stream imageStream = DependencyService.Get<ISave>().LoadFromFile(@"logo.jpg");
//Load the image from the stream
PdfBitmap image = new PdfBitmap(imageStream);
感谢您的帮助,因为我已经坚持了 3 天了。
【问题讨论】:
-
最好在syncfusion网站上问这个问题,如果它是一个错误,他们往往会很快回答
-
你把你的图片作为“嵌入式资源”了吗?只是在黑暗中拍摄,但我在使用 pdf 文件时遇到了类似的问题,我不知道不嵌入 ios 是否仍然有效,因为我只尝试过使用 android
-
另一种可能是:你在android上实现了ISave接口吗?因为你没有在这里提到我假设它没有实现
-
@Ricardo Dias Morais,不幸的是,我都做了。
标签: c# xamarin.forms syncfusion