Placing Stamps |
Stamps can be placed on a page using PostToStampRelationForAnnotation of Page, or by using PostToAnnotationRelationForDocumentAnnotations of Document.
Note |
---|
If Location property of StampPlacement is not specified stamp is automatically placed on the best matching empty region on the page. |
Note |
---|
If the stamp has form fields, then you should specify their values in Field of StampPlacement. |
Note |
---|
If the stamp is password protected you must fill the Password property of StampPlacement with the password of the current user. |
This example shows how you can place a stamp on a page
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class Examples { static public void PlaceStampOnPage(Page page, string stampId, int layer, DWPoint location) { var placedStamp = page.PostToStampRelationForAnnotation(new StampPlacement() { StampId = stampId, Layer = layer, Location = location, Field = new List<FormFieldValue>() { new FormFieldValue() { Name = "<#1>", TypedValue = new DocumentIndexFieldValue() { ItemElementName = ItemChoiceType.DateTime, Item = DateTime.UtcNow, }, }, new FormFieldValue() { Name = "<#2>", TypedValue = new DocumentIndexFieldValue() { ItemElementName = ItemChoiceType.Keywords, Item = new DocumentIndexFieldKeywords() { Keyword = new List<string>() { "qwe", "123" } } }, }, new FormFieldValue() { Name = "<#3>", TypedValue = new DocumentIndexFieldValue() { ItemElementName = ItemChoiceType.String, Item = "Some value" } } }, }); } } }
This example shows how you can place a stamp on a page from document object
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class Examples { static public DocumentAnnotations PlaceStampOnDocument( this Document document, int sectionNumber, int page, int layer, DWPoint location, string stampId) { var documentStampPlacement = new DocumentAnnotationsPlacement() { Annotations = new List<SectionAnnotationsPlacement>() { new SectionAnnotationsPlacement() { PageNumber = page, SectionNumber = sectionNumber, AnnotationsPlacement = new AnnotationsPlacement() { Items = new List<object>() { GetStampPlacement(layer, location, stampId) } } }, } }; return document.PostToAnnotationRelationForDocumentAnnotations(documentStampPlacement); } private static StampPlacement GetStampPlacement(int layer, DWPoint location, string stampId) { return new StampPlacement() { StampId = stampId, Layer = layer, Location = location, Field = new List<FormFieldValue>() { new FormFieldValue() { Name = "<#1>", TypedValue = new DocumentIndexFieldValue() { ItemElementName = ItemChoiceType.DateTime, Item = DateTime.UtcNow, }, }, new FormFieldValue() { Name = "<#2>", TypedValue = new DocumentIndexFieldValue() { ItemElementName = ItemChoiceType.Keywords, Item = new DocumentIndexFieldKeywords() { Keyword = new List<string>() { "Hotel", "Booking" } } }, }, new FormFieldValue() { Name = "<#3>", TypedValue = new DocumentIndexFieldValue() { ItemElementName = ItemChoiceType.String, Item = "Holidays" } } }, }; } } }