feat(BurnPdfCommand): implement AddImageAnnotation with attachment handling
- Added logic to AddImageAnnotation to handle image attachments from a dictionary. - Removed NotImplementedException placeholder for AddImageAnnotation with attachments. - Refactored code to convert annotation bounds from pixels to inches before adding images.
This commit is contained in:
parent
dff99b163d
commit
d237b4ab95
@ -305,7 +305,23 @@ public class BurnPdfCommandHandler : IRequestHandler<BurnPdfCommand>
|
|||||||
|
|
||||||
private void AddImageAnnotation(Annotation pAnnotation, Dictionary<string, Attachment> pAttachments)
|
private void AddImageAnnotation(Annotation pAnnotation, Dictionary<string, Attachment> pAttachments)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var oAttachment = pAttachments
|
||||||
|
.Where(a => a.Key == pAnnotation.ImageAttachmentId)
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
|
if (oAttachment.Value == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Convert pixels to Inches
|
||||||
|
var oBounds = pAnnotation.Bbox.Select(ToInches).ToList();
|
||||||
|
|
||||||
|
var oX = oBounds[0];
|
||||||
|
var oY = oBounds[1];
|
||||||
|
var oWidth = oBounds[2];
|
||||||
|
var oHeight = oBounds[3];
|
||||||
|
|
||||||
|
_manager.SelectPage(pAnnotation.PageIndex + 1);
|
||||||
|
_manager.AddEmbeddedImageAnnotFromBase64(oAttachment.Value.Binary, (float)oX, (float)oY, (float)oWidth, (float)oHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddInkAnnotation(int page, string value)
|
private void AddInkAnnotation(int page, string value)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user