✅ PdfPig
I don't know what I am doing wrong. I am trying to generate a PDF document and attach an image (PNG) to the PDF Document. The problem is that I keep getting an index out of range exception. I did the math, and the points I use for the image coordinates are correct (At least, I am 98% sure).
This is what I have:
For context: X1 and Y1 = Bottom Left coordinates and X2 and Y2 is top right.
7 Replies
which line are you getting that at?
@apnxmammoth share the exact line and error message you get that on
page.AddPng(qrCodeBytes, qrPlacement);
Sorry Anton. I didn't get notified when you messaged, but at page.AddPng()
and the full exception?
System.IndexOutOfRangeException: Index was outside the bounds of the array. at UglyToad.PdfPig.Images.Png.RawPngData.GetPixel(Int32 x, Int32 y) at UglyToad.PdfPig.Writer.PdfPageBuilder.AddPng(Stream pngStream, PdfRectangle placementRectangle) at UglyToad.PdfPig.Writer.PdfPageBuilder.AddPng(Byte[] pngBytes, PdfRectangle placementRectangle) at PrintHelper.GeneratePrintableLabel(LogisticsViewModel model) in Helper\PrintHelper.cs:line 23 at LogisticsController.Create(LogisticsViewModel model) in Controllers\LogisticsController.cs:line 51 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker...
Unable to send full exception, character limit.
put it into a gist
https://gist.github.com/
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View