Как добавить статус просмотра аннотаций pdf-текста с помощью itextsharp?
I am working using itextsharp in c# .net. I have multiple text annotation and multiple reply to that annotation, everything working fine but when i try to add review status (Eg: Accepted,Rejected,None etc..) to the annotation. It is not showing in pdf. I had export the data file from pdf and checked. Annotation's review status is coming in data file. If i changed the status flag of annotation review status /F 28/ to /F 30/ in data file,review status showing correctly in pdf. How do i set status flag of annotation as /F 30/. I tried all annotation flag in itextsharp /F 30/ not coming.
Тег аннотации в экспортированном файле pdf данных
2 0 obj /Contents(brit mkt level 1 no 5)/F 28/M(D:20160928170753+05'30') NM(1888890568)/Page 0/Rect[231.0 605.0 249.0 625.0]/Subtype/Text/T(BM/01 Britania marketing | Marketing)
Тег обзора состояния аннотации в экспортированном файле данных pd
7 0 obj /Contents(None by Britania commercial)/F 28/IRT(1888890568)/M(D:20161006111625+05'30')/NM(63aafcf6-742e-4ffb-9465-2dba3c731bf2)/Page 0/Popup 8 0 R/Rect[231.0 605.0 249.0 625.0]/State(None)/StateModel(Review)/Subtype/Text/T(Britania commercial) endobj 8 0 obj /F 28/Open false/Page 0/Parent 7 0 R/Rect[2160.0 505.0 2340.0 625.0]/Subtype/Popup/Type/Annot endobj
Что я уже пробовал:
if (noteArray.Count == 1) { var fstTemp = new MemoryStream(); var stamper = new PdfStamper(reader, fstTemp); if (!string.IsNullOrEmpty(reviseStatus)) { var writer = stamper.Writer; var page = reader.GetPageN(pageNo); var annots = page.GetAsArray(PdfName.ANNOTS); var count = annots.Size; var notes = (Dictionary<string, object>) noteArray[0]; for (var l = 0; l < count; l++) { var sticky = annots.GetAsDict(l); var cmntid = sticky.Get(PdfName.NM); if ((cmntid !=null?cmntid.ToString() : "") == notes["commentId"].ToString()) { var stickyRect = sticky.GetAsArray(PdfName.RECT); var stickyRectangle = new iTextSharp.text.Rectangle( stickyRect.GetAsNumber(0).FloatValue, stickyRect.GetAsNumber(1).FloatValue, stickyRect.GetAsNumber(2).FloatValue, stickyRect.GetAsNumber(3).FloatValue); var replySticky = PdfAnnotation.CreateText(writer, stickyRectangle, revisedBy, reviseStatus + " by " + revisedBy, true, null); replySticky.Put(PdfName.IRT, annots.GetAsIndirectObject(l)); replySticky.Put(PdfName.M,new PdfDate(convertTimestamp(Double.Parse(revisedOn)))); replySticky.Put(PdfName.STATE, new PdfString(reviseStatus)); var n = sticky.GetAsNumber(PdfName.F); replySticky.Put(PdfName.F, new PdfNumber(n.IntValue |PdfAnnotation.FLAGS_HIDDEN)); //PdfAnnotation.FLAGS_HIDDEN replySticky.Put(PdfName.OPEN,PdfBoolean.PDFFALSE); replySticky.Put(new PdfName("StateModel"), new PdfString("Review")); var canvas = stamper.GetOverContent(pageNo); canvas.AddAnnotation(replySticky,true); } } } fout = fstTemp; stamper.Close(); reader = new iTextSharp.text.pdf.PdfReader((byte[]) fout.ToArray()); }