I would like to load image to pdf from stream. When I try to do that I get an error
System.ArgumentNullException: 'Value cannot be null.
Parameter name: stream'
Here is my code
Stream imageStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("MyApp.Resources.drawable.image.png");
PdfImage image = PdfImage.FromStream(imageStream); <---- here is error
g.DrawImage(image, new PointF(20, 20));
Firstly , in this way you need to put the image in Forms project instead of Android project .In my demo I put the image in the folder Assets . And the code should like the following
var assembly = this.GetType().GetTypeInfo().Assembly;
Stream s = assembly.GetManifestResourceStream("MyApp.Assets.icon.png");
In addition , make sure that the build action of the image is Embeddded Resource
Right Click the image -> Properties