Hi, i have a problem that i cant put an image from the camera to the pdf. It put the same error "Image could not read". How can i do it?
This is the path they gave me when i take a photo = "/storage/emulated/0/Android/data/com.companyname.atecresacalculator/files/Pictures/fotoparapdf_12.jpg"
Code:
Code:
//CompartirInformacion is SharedInformation
namespace AtecresaCalculator.Service
{
public class CompartirInformacion
{
public static string x;
public static string y;
}
}
Code:
Row row = table.AddRow();
table.Rows.HeightRule = RowHeightRule.Auto;
row.Cells[0].AddParagraph(text);
row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
row.Cells[1].AddParagraph(texto);
row.Cells[1].AddImage(FromFile(CompartirInformacion.y));
row.Cells[1].VerticalAlignment = VerticalAlignment.Center;
Code:
private async void sacarFoto_Clicked(object sender, EventArgs e)
{
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
await DisplayAlert("Error en la cámara", "Activa los permisos para usar cámara", "Ok");
return;
}
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small,
Name = "fotoparapdf.jpg",
CompressionQuality = 100,
DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Rear,
});
if (file == null)
return;
await DisplayAlert("Ruta de la foto", file.Path, "Ok");
CompartirInformacion.y = file.Path;
}