public PdfAnnotation CreateAnnotation(PdfWriter writer) { PdfAnnotation annotation = new PdfAnnotation(writer, new Rectangle(llx, lly, urx, ury)); if (newPage != 0) { PdfIndirectReference refi = writer.GetPageReference(newPage); destination[0] = refi; } if (destination != null) { annotation.Put(PdfName.DEST, destination); } foreach (object key in parameters.Keys) { annotation.hashMap[key] = parameters[key]; } return(annotation); }
public static PdfAnnotation CreateInk(PdfWriter writer, Rectangle rect, string contents, float[][] inkList) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.INK); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); PdfArray outer = new PdfArray(); for (int k = 0; k < inkList.Length; ++k) { PdfArray inner = new PdfArray(); float[] deep = inkList[k]; for (int j = 0; j < deep.Length; ++j) { inner.Add(new PdfNumber(deep[j])); } outer.Add(inner); } annot.Put(PdfName.INKLIST, outer); return(annot); }
public static PdfAnnotation ShallowDuplicate(PdfAnnotation annot) { PdfAnnotation dup; if (annot.IsForm()) { dup = new PdfFormField(annot.writer); PdfFormField dupField = (PdfFormField)dup; PdfFormField srcField = (PdfFormField)annot; dupField.parent = srcField.parent; dupField.kids = srcField.kids; } else { dup = new PdfAnnotation(annot.writer, null); } dup.Merge(annot); dup.form = annot.form; dup.annotation = annot.annotation; dup.templates = annot.templates; return(dup); }
/** * Creates a screen PdfAnnotation * @param writer * @param rect * @param clipTitle * @param fs * @param mimeType * @param playOnDisplay * @return a screen PdfAnnotation * @throws IOException */ public static PdfAnnotation CreateScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, bool playOnDisplay) { PdfAnnotation ann = new PdfAnnotation(writer, rect); ann.Put(PdfName.SUBTYPE, PdfName.SCREEN); ann.Put(PdfName.F, new PdfNumber(FLAGS_PRINT)); ann.Put(PdfName.TYPE, PdfName.ANNOT); ann.SetPage(); PdfIndirectReference refi = ann.IndirectReference; PdfAction action = PdfAction.Rendition(clipTitle, fs, mimeType, refi); PdfIndirectReference actionRef = writer.AddToBody(action).IndirectReference; // for play on display add trigger event if (playOnDisplay) { PdfDictionary aa = new PdfDictionary(); aa.Put(new PdfName("PV"), actionRef); ann.Put(PdfName.AA, aa); } ann.Put(PdfName.A, actionRef); return(ann); }
public static PdfAnnotation CreateText(PdfWriter writer, Rectangle rect, string title, string contents, bool open, string icon) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.TEXT); if (title != null) { annot.Put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE)); } if (contents != null) { annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); } if (open) { annot.Put(PdfName.OPEN, PdfBoolean.PDFTRUE); } if (icon != null) { annot.Put(PdfName.NAME, new PdfName(icon)); } return(annot); }
public static PdfAnnotation CreateSquareCircle(PdfWriter writer, Rectangle rect, string contents, bool square) { PdfAnnotation annot = new PdfAnnotation(writer, rect); if (square) annot.Put(PdfName.SUBTYPE, PdfName.SQUARE); else annot.Put(PdfName.SUBTYPE, PdfName.CIRCLE); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); return annot; }
internal override void AddAnnotation(PdfAnnotation annot) { ((PdfStamperImp)writer).AddAnnotation(annot, ps.pageN); }
/// <summary> /// Sets a generic annotation to this Chunk. /// </summary> /// <param name="annotation">the annotation</param> /// <returns>this Chunk</returns> public Chunk SetAnnotation(PdfAnnotation annotation) { return SetAttribute(PDFANNOTATION, annotation); }
public void AddAnnotation(PdfAnnotation annot) { if (annot.IsForm()) { PdfFormField field = (PdfFormField)annot; if (field.Parent == null) AddFormFieldRaw(field); } else annotations.Add(annot); }
public void AddAnnotation(PdfAnnotation annot) { ArrayList allAnnots = new ArrayList(); if (annot.IsForm()) { PdfFormField field = (PdfFormField)annot; if (field.Parent != null) { return; } ExpandFields(field, allAnnots); if (cstp.fieldTemplates == null) { cstp.fieldTemplates = new Hashtable(); } } else { allAnnots.Add(annot); } for (int k = 0; k < allAnnots.Count; ++k) { annot = (PdfAnnotation)allAnnots[k]; if (annot.IsForm()) { if (!annot.IsUsed()) { Hashtable templates = annot.Templates; if (templates != null) { foreach (object tpl in templates.Keys) { cstp.fieldTemplates[tpl] = null; } } } PdfFormField field = (PdfFormField)annot; if (field.Parent == null) { AddDocumentField(field.IndirectReference); } } if (annot.IsAnnotation()) { PdfObject pdfobj = PdfReader.GetPdfObject(pageN.Get(PdfName.ANNOTS), pageN); PdfArray annots = null; if (pdfobj == null || !pdfobj.IsArray()) { annots = new PdfArray(); pageN.Put(PdfName.ANNOTS, annots); } else { annots = (PdfArray)pdfobj; } annots.Add(annot.IndirectReference); if (!annot.IsUsed()) { PdfRectangle rect = (PdfRectangle)annot.Get(PdfName.RECT); if (rect != null && (rect.Left != 0 || rect.Right != 0 || rect.Top != 0 || rect.Bottom != 0)) { int rotation = reader.GetPageRotation(pageN); Rectangle pageSize = reader.GetPageSizeWithRotation(pageN); switch (rotation) { case 90: annot.Put(PdfName.RECT, new PdfRectangle( pageSize.Top - rect.Bottom, rect.Left, pageSize.Top - rect.Top, rect.Right)); break; case 180: annot.Put(PdfName.RECT, new PdfRectangle( pageSize.Right - rect.Left, pageSize.Top - rect.Bottom, pageSize.Right - rect.Right, pageSize.Top - rect.Top)); break; case 270: annot.Put(PdfName.RECT, new PdfRectangle( rect.Bottom, pageSize.Right - rect.Left, rect.Top, pageSize.Right - rect.Right)); break; } } } } if (!annot.IsUsed()) { annot.SetUsed(); cstp.AddToBody(annot, annot.IndirectReference); } } }
public PdfAnnotation CreateAnnotation(PdfWriter writer) { PdfAnnotation annotation = new PdfAnnotation(writer, new Rectangle(llx, lly, urx, ury)); if (newPage != 0) { PdfIndirectReference refi = writer.GetPageReference(newPage); destination[0] = refi; } if (destination != null) annotation.Put(PdfName.DEST, destination); foreach (object key in parameters.Keys) annotation.hashMap[key] = parameters[key]; return annotation; }
public static PdfAnnotation ShallowDuplicate(PdfAnnotation annot) { PdfAnnotation dup; if (annot.IsForm()) { dup = new PdfFormField(annot.writer); PdfFormField dupField = (PdfFormField)dup; PdfFormField srcField = (PdfFormField)annot; dupField.parent = srcField.parent; dupField.kids = srcField.kids; } else dup = new PdfAnnotation(annot.writer, null); dup.Merge(annot); dup.form = annot.form; dup.annotation = annot.annotation; dup.templates = annot.templates; return dup; }
/** Creates a file attachment annotation * @param writer * @param rect * @param contents * @param fs * @return the annotation * @throws IOException */ public static PdfAnnotation CreateFileAttachment(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.FILEATTACHMENT); if (contents != null) annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); annot.Put(PdfName.FS, fs.Reference); return annot; }
public void AddAnnotation(PdfAnnotation annot) { ArrayList allAnnots = new ArrayList(); if (annot.IsForm()) { PdfFormField field = (PdfFormField)annot; if (field.Parent != null) return; ExpandFields(field, allAnnots); if (cstp.fieldTemplates == null) cstp.fieldTemplates = new Hashtable(); } else allAnnots.Add(annot); for (int k = 0; k < allAnnots.Count; ++k) { annot = (PdfAnnotation)allAnnots[k]; if (annot.IsForm()) { if (!annot.IsUsed()) { Hashtable templates = annot.Templates; if (templates != null) { foreach (object tpl in templates.Keys) { cstp.fieldTemplates[tpl] = null; } } } PdfFormField field = (PdfFormField)annot; if (field.Parent == null) AddDocumentField(field.IndirectReference); } if (annot.IsAnnotation()) { PdfObject pdfobj = PdfReader.GetPdfObject(pageN.Get(PdfName.ANNOTS), pageN); PdfArray annots = null; if (pdfobj == null || !pdfobj.IsArray()) { annots = new PdfArray(); pageN.Put(PdfName.ANNOTS, annots); } else annots = (PdfArray)pdfobj; annots.Add(annot.IndirectReference); if (!annot.IsUsed()) { PdfRectangle rect = (PdfRectangle)annot.Get(PdfName.RECT); if (rect != null && (rect.Left != 0 || rect.Right != 0 || rect.Top != 0 || rect.Bottom != 0)) { int rotation = reader.GetPageRotation(pageN); Rectangle pageSize = reader.GetPageSizeWithRotation(pageN); switch (rotation) { case 90: annot.Put(PdfName.RECT, new PdfRectangle( pageSize.Top - rect.Bottom, rect.Left, pageSize.Top - rect.Top, rect.Right)); break; case 180: annot.Put(PdfName.RECT, new PdfRectangle( pageSize.Right - rect.Left, pageSize.Top - rect.Bottom, pageSize.Right - rect.Right, pageSize.Top - rect.Top)); break; case 270: annot.Put(PdfName.RECT, new PdfRectangle( rect.Bottom, pageSize.Right - rect.Left, rect.Top, pageSize.Right - rect.Right)); break; } } } } if (!annot.IsUsed()) { annot.SetUsed(); cstp.AddToBody(annot, annot.IndirectReference); } } }
public override void AddAnnotation(PdfAnnotation annot) { }
internal override void AddAnnotation(PdfAnnotation annot, int page) { annot.Page = page; AddAnnotation(annot, reader.GetPageN(page)); }
/** * @see com.lowagie.text.pdf.PdfWriter#addAnnotation(com.lowagie.text.pdf.PdfAnnotation) */ public override void AddAnnotation(PdfAnnotation annot) { throw new Exception("Unsupported in this context. Use PdfStamper.AddAnnotation()"); }
/** * Adds an annotation of form field in a specific page. This page number * can be overridden with {@link PdfAnnotation#setPlaceInPage(int)}. * @param annot the annotation * @param page the page */ public void AddAnnotation(PdfAnnotation annot, int page) { stamper.AddAnnotation(annot, page); }
public static PdfAction CreateHide(PdfAnnotation annot, bool hide) { return CreateHide(annot.IndirectReference, hide); }
public static PdfAnnotation CreateStamp(PdfWriter writer, Rectangle rect, string contents, string name) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.STAMP); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); annot.Put(PdfName.NAME, new PdfName(name)); return annot; }
public static PdfAnnotation CreateText(PdfWriter writer, Rectangle rect, string title, string contents, bool open, string icon) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.TEXT); if (title != null) annot.Put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE)); if (contents != null) annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); if (open) annot.Put(PdfName.OPEN, PdfBoolean.PDFTRUE); if (icon != null) { annot.Put(PdfName.NAME, new PdfName(icon)); } return annot; }
public static PdfAnnotation CreateFreeText(PdfWriter writer, Rectangle rect, string contents, PdfContentByte defaultAppearance) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.FREETEXT); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); annot.DefaultAppearanceString = defaultAppearance; return annot; }
protected static PdfAnnotation CreateLink(PdfWriter writer, Rectangle rect, PdfName highlight) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.LINK); if (!highlight.Equals(HIGHLIGHT_INVERT)) annot.Put(PdfName.H, highlight); return annot; }
/** Adds a <CODE>PdfAnnotation</CODE> or a <CODE>PdfFormField</CODE> * to the document. Only the top parent of a <CODE>PdfFormField</CODE> * needs to be added. * @param annot the <CODE>PdfAnnotation</CODE> or the <CODE>PdfFormField</CODE> to add */ public virtual void AddAnnotation(PdfAnnotation annot) { pdf.AddAnnotation(annot); }
public static PdfAnnotation CreateInk(PdfWriter writer, Rectangle rect, string contents, float[][] inkList) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.INK); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); PdfArray outer = new PdfArray(); for (int k = 0; k < inkList.Length; ++k) { PdfArray inner = new PdfArray(); float[] deep = inkList[k]; for (int j = 0; j < deep.Length; ++j) inner.Add(new PdfNumber(deep[j])); outer.Add(inner); } annot.Put(PdfName.INKLIST, outer); return annot; }
public static PdfAction CreateHide(PdfAnnotation annot, bool hide) { return(CreateHide(annot.IndirectReference, hide)); }
public static PdfAnnotation CreateLine(PdfWriter writer, Rectangle rect, string contents, float x1, float y1, float x2, float y2) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.LINE); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); PdfArray array = new PdfArray(new PdfNumber(x1)); array.Add(new PdfNumber(y1)); array.Add(new PdfNumber(x2)); array.Add(new PdfNumber(y2)); annot.Put(PdfName.L, array); return annot; }
public static PdfAnnotation CreateMarkup(PdfWriter writer, Rectangle rect, string contents, int type, float[] quadPoints) { PdfAnnotation annot = new PdfAnnotation(writer, rect); PdfName name = PdfName.HIGHLIGHT; switch (type) { case MARKUP_UNDERLINE: name = PdfName.UNDERLINE; break; case MARKUP_STRIKEOUT: name = PdfName.STRIKEOUT; break; case MARKUP_SQUIGGLY: name = PdfName.SQUIGGLY; break; } annot.Put(PdfName.SUBTYPE, name); annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); PdfArray array = new PdfArray(); for (int k = 0; k < quadPoints.Length; ++k) array.Add(new PdfNumber(quadPoints[k])); annot.Put(PdfName.QUADPOINTS, array); return annot; }
internal virtual void AddAnnotation(PdfAnnotation annot, int page) { AddAnnotation(annot); }
public static PdfAnnotation CreatePopup(PdfWriter writer, Rectangle rect, string contents, bool open) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.Put(PdfName.SUBTYPE, PdfName.POPUP); if (contents != null) annot.Put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); if (open) annot.Put(PdfName.OPEN, PdfBoolean.PDFTRUE); return annot; }
public void AddPlainAnnotation(PdfAnnotation annot) { annotations.Add(annot); }
/** * Creates a screen PdfAnnotation * @param writer * @param rect * @param clipTitle * @param fs * @param mimeType * @param playOnDisplay * @return a screen PdfAnnotation * @throws IOException */ public static PdfAnnotation CreateScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, bool playOnDisplay) { PdfAnnotation ann = new PdfAnnotation(writer, rect); ann.Put(PdfName.SUBTYPE, PdfName.SCREEN); ann.Put (PdfName.F, new PdfNumber(FLAGS_PRINT)); ann.Put(PdfName.TYPE, PdfName.ANNOT); ann.SetPage(); PdfIndirectReference refi = ann.IndirectReference; PdfAction action = PdfAction.Rendition(clipTitle,fs,mimeType, refi); PdfIndirectReference actionRef = writer.AddToBody(action).IndirectReference; // for play on display add trigger event if (playOnDisplay) { PdfDictionary aa = new PdfDictionary(); aa.Put(new PdfName("PV"), actionRef); ann.Put(PdfName.AA, aa); } ann.Put(PdfName.A, actionRef); return ann; }
internal void AddAnnotation(PdfAnnotation annot) { pageEmpty = false; annotationsImp.AddAnnotation(annot); }