![](/img/trans.png)
[英]Is there any way to have a background image in MigraDoc / PDFsharp?
[英]Put an image from camera with migradoc or pdfsharp with xamarin forms
我有一個問題,我無法將相機中的圖像放到 pdf 中。 它提出了同樣的錯誤"Image could not read"
。 我該怎么做? 這是我拍照時他們給我的路徑=
"/storage/emulated/0/Android/data/com.companyname.atecresacalculator/files/Pictures/fotoparapdf_12.jpg"
來自 CompartirInformacion(SharedInformation) 的代碼:
namespace AtecresaCalculator.Service
{
public class CompartirInformacion
{
public static string x;
public static string y;
}
}
我在pdf中添加的地方:
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;
點擊拍照:
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;
}
目前你不能用這個包做你所要求的。 如果你需要這樣做,你應該嘗試使用 Syncfusion pdf 包,不好的是它是付費的,但你可以免費創建一個社區帳戶
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.