Difference between revisions of "HotSpotting (Plugin)"
(Created page with "==Overview== This Plugin is designed to enable the work with HotSpots and Annotations on the server side. ==Usage== The Plugin exposes several methods through the classes ''A...") |
|||
Line 5: | Line 5: | ||
The Plugin exposes several methods through the classes ''Annotating'' and "HotSpotting" that can be used in {{UBIK}} customizing code. | The Plugin exposes several methods through the classes ''Annotating'' and "HotSpotting" that can be used in {{UBIK}} customizing code. | ||
− | = Annotating = | + | = Annotating (write annotation to revision) = |
Example script for the {{UBIK}} [[Debugger|Whobert]] that shows the basic capabilities of the Plugin. | Example script for the {{UBIK}} [[Debugger|Whobert]] that shows the basic capabilities of the Plugin. | ||
Line 28: | Line 28: | ||
UBIK.Document.DocumentClass sourcedoc = obj.Environment.UBIKDataFactory().ContentObject(new Guid("a847ab9f-1e4c-42ed-933f-833fb8d69b5e")) as UBIK.Document.DocumentClass; | UBIK.Document.DocumentClass sourcedoc = obj.Environment.UBIKDataFactory().ContentObject(new Guid("a847ab9f-1e4c-42ed-933f-833fb8d69b5e")) as UBIK.Document.DocumentClass; | ||
− | + | // create an instance of the Annotated Document wrapper | |
− | // | + | UBIK.Module.Annotation.AnnotatedDocument pdf = new UBIK.Module.Annotation.AnnotatedDocument(sourcedoc); |
− | + | ||
− | + | // optional you can set the relation name | |
− | // | + | pdf.SetRedlineRelationName("MY_RELATION_NAME"); |
− | if( | + | |
+ | UBIK.Document.DocumentClass revDoc; | ||
+ | |||
+ | // create a new revision and write annotations to pdf file | ||
+ | // True => clear annotations property afterwards | ||
+ | if (pdf.WriteAnnotationToRevisionDoc(true, out revDoc)) | ||
{ | { | ||
− | + | revDoc.Save(); // save revision document | |
− | + | pdf.Save(); // save original document with cleared annotations property | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
+ | |||
+ | Debugger.Output(this, "*** Finished"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | = Annotating (write annotation to original document) = | ||
+ | Example script for the {{UBIK}} [[Debugger|Whobert]] that shows the basic capabilities of the Plugin. | ||
+ | |||
+ | <source lang="csharp"> | ||
+ | |||
+ | using System; | ||
+ | using System.Windows.Forms; | ||
+ | using UBIK.Kernel; | ||
+ | using UBIK.Compiler; | ||
+ | using System.Linq; | ||
+ | using UBIK.Module.HotSpotting.Module; | ||
+ | using UBIK.WinX.HotSpotting.Models; | ||
+ | using UBIK.WinX.HotSpotting.Common; | ||
+ | |||
+ | namespace Studio | ||
+ | { | ||
+ | public class ObjectTest | ||
+ | { | ||
+ | public void TestObject (params BaseClass[] InVariables) | ||
+ | { | ||
+ | BaseClass obj = InVariables[0]; | ||
+ | UBIK.Document.DocumentClass sourcedoc = obj.Environment.UBIKDataFactory().ContentObject(new Guid("a847ab9f-1e4c-42ed-933f-833fb8d69b5e")) as UBIK.Document.DocumentClass; | ||
+ | |||
+ | // create an instance of the Annotated Document wrapper | ||
+ | UBIK.Module.Annotation.AnnotatedDocument pdf = new UBIK.Module.Annotation.AnnotatedDocument(sourcedoc); | ||
+ | |||
+ | // write annotations to pdf file | ||
+ | // True => clear annotations property afterwards | ||
+ | pdf.WriteAnnotationToSourceDoc(true); | ||
+ | pdf.Save(); // save original document with cleared annotations property | ||
Debugger.Output(this, "*** Finished"); | Debugger.Output(this, "*** Finished"); | ||
Line 150: | Line 179: | ||
Debugger.Output(this, "*** Finished"); | Debugger.Output(this, "*** Finished"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | = Annotating (old API) = | ||
+ | Example script for the {{UBIK}} [[Debugger|Whobert]] that shows the basic capabilities of the Plugin. | ||
+ | |||
+ | <source lang="csharp"> | ||
+ | |||
+ | using System; | ||
+ | using System.Windows.Forms; | ||
+ | using UBIK.Kernel; | ||
+ | using UBIK.Compiler; | ||
+ | using System.Linq; | ||
+ | using UBIK.Module.HotSpotting.Module; | ||
+ | using UBIK.WinX.HotSpotting.Models; | ||
+ | using UBIK.WinX.HotSpotting.Common; | ||
+ | |||
+ | namespace Studio | ||
+ | { | ||
+ | public class ObjectTest | ||
+ | { | ||
+ | public void TestObject (params BaseClass[] InVariables) | ||
+ | { | ||
+ | BaseClass obj = InVariables[0]; | ||
+ | UBIK.Document.DocumentClass sourcedoc = obj.Environment.UBIKDataFactory().ContentObject(new Guid("a847ab9f-1e4c-42ed-933f-833fb8d69b5e")) as UBIK.Document.DocumentClass; | ||
+ | |||
+ | var annotating = new Annotating(); | ||
+ | //Load the Inking imformation from the UBIK document | ||
+ | InkingLayer[] ann = annotating.Load(sourcedoc); | ||
+ | |||
+ | //If we have an Image, merge trhe inking directly into the picture | ||
+ | if(annotating.GetAnnotationFileType(sourcedoc) == Annotating.AnnotationFileTypes.Image) | ||
+ | { | ||
+ | if(annotating.UpdateRedline(ann, sourcedoc)) | ||
+ | { | ||
+ | annotating.Delete(sourcedoc); | ||
+ | //sourcedoc.MP_CREATE_PDF = false; | ||
+ | sourcedoc.Save(); | ||
+ | } | ||
+ | } | ||
+ | //If we have a pdf, create a subdocument (redline) first and merge the inking into the version rather than the original | ||
+ | else if(annotating.GetAnnotationFileType(sourcedoc) == Annotating.AnnotationFileTypes.PdfDocument) | ||
+ | { | ||
+ | if(annotating.CreateRedline(ann, sourcedoc, "REL_FILEDOC_REDLINEDOC")) | ||
+ | { | ||
+ | //sourcedoc.MP_CREATE_PDF = false; | ||
+ | sourcedoc.Save(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Debugger.Output(this, "*** Finished"); | ||
} | } | ||
} | } |
Latest revision as of 13:29, 18 January 2021
Overview
This Plugin is designed to enable the work with HotSpots and Annotations on the server side.
Usage
The Plugin exposes several methods through the classes Annotating and "HotSpotting" that can be used in UBIK® customizing code.