Skip to content
Other versions

Loading…

Stamp samples

First, you must create the webservice object:

OKMWebservices ws = OKMWebservicesFactory.newInstance(host);

Then should login using the method “login”. You can access the “login” method from webservice object “ws” as is shown below:

ws.login(user, password);

At this point you can use all the Stamp methods from “stamp” class as is shown below:

ws.stamp.getAllStamps();

Description:

Method Return values Description
getAllStamps() List Returns a list of the stamp items

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<StampItem> stamps = ws.stamp.getAllStamps();
foreach(StampItem stamItem in stamps)
{
System.Console.WriteLine(stamItem.name);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getStampTextByPk(long id, String uuid) StampText Return the stamp of type Text by Id.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long id = 1;
List<StampItem> stamps = ws.stamp.getStampTextByPk(id, document.uuid);
System.Console.WriteLine(stamp.name);
System.Console.WriteLine(stamp.description);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getStampImageByPk(long id, String uuid) StampImage Return the stamp of type image by Id.

Example:

using System;
using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long id = 1;
List<StampItem> stamps = ws.stamp.getStampImageByPk(id, document.uuid);
System.Console.WriteLine(stampImage.name);
System.Console.WriteLine(stampImage.description);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getStampBarcodeByPk(long id, String uuid) StampBarcode Return the stamp of type barcode by Id.

Example:

using System;
using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long id = 1;
StampBarcode stampBarcode = ws.stamp.getStampBarcodeByPk(id, "6330d2a0-529f-4c14-baa1-ce6a92004e01");
System.Console.WriteLine(stampBarcode.name);
System.Console.WriteLine(stampBarcode.description);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
calculateStampCoordinates(long imgToStampWidth, long imgToStampHeight, long floatingDivWidth,
long floatingDivHeight, String exprX, String exprY, String stampType, String stampAlign)
StampCoordinates Return the calculated stamp coordinates.

The parameter stampAlign is the Text Align

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
// Parameters
long imgToStampWidth = 100;
long imgToStampHeight = 100;
long floatingDivWidth = 250;
long floatingDivHeight = 300;
string exprX = "PAGE_CENTER - IMAGE_WIDTH / 2";
string exprY = "PAGE_MIDDLE - IMAGE_HEIGHT / 2";
string stampType = "text";
string stampAlign = "center";
StampCoordinates stampCoordinates = ws.stamp.calculateStampCoordinates(imgToStampWidth, imgToStampHeight,
floatingDivWidth, floatingDivHeight, exprX, exprY, stampType, stampAlign);
System.Console.WriteLine("X = " + stampCoordinates.x + ", Y = " + stampCoordinates.y);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
calculateStampExpressions(long imgToStampWidth, long imgToStampHeight, long posX, long posY) StampExpressions Return the calculated stamp expressions for X and Y.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
// Parameters
long imgToStampWidth = 100;
long imgToStampHeight = 100;
long posX = 10;
long posY = 50;
StampExpressions stampExpressions = ws.stamp.calculateStampExpressions(imgToStampWidth, imgToStampHeight, posX, posY);
System.Console.WriteLine("X = " + stampExpressions.exprX + ", Y = " + stampExpressions.exprY);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
stampText(String  uuid, long id) void Stamp text in a document.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long id = "1";
ws.stamp.stampText("babe24df-c443-49a5-9453-39dfc9b27924", id);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
stampImage(String uuid, long id) void Stamp image in a document.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long id = "3";
ws.stamp.stampImage("babe24df-c443-49a5-9453-39dfc9b27924", id);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
stampBarcode(String uuid, long id) void Stamp barcode in a document.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long id = 1;
ws.stamp.stampBarcode("6330d2a0-529f-4c14-baa1-ce6a92004e01", id);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
stampImageCustom(String uuid, long id, String exprX, String exprY, String range, String personalStampUuid) void Stamp in a document with a custom image.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<Document> docs = ws.stamp.getPersonalStamps();
foreach (Document doc in docs)
{
System.Console.WriteLine(doc.toString());
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}

Description:

Method Return values Description
getPersonalStampImage(String uuid, long id) StampPersonalImage Return the personal seal processed.

Example:

using System; using System.Collections.Generic;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
long stampId = 1;
StampPersonalImage stampPersonalImage = ws.stamp.getPersonalStampImage("928de61e-6ceb-4f94-bf20-9ba2405c5cee", stampId);
System.Console.WriteLine(stampPersonalImage.ToString());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}