You are viewing limited content. For full access, please sign in.

Question

Question

How do you create a stamp through the SDK?

asked on March 23, 2015

I have a script that I am building through workflow. Currently I have a bitmap that is being created and I would like this to be imported into Laserfiche so I can apply this stamp. I was looking through the documentation and I haven't been able to figure out how to create a stamp or at least override one. If anyone can assist with how to create a stamp from importing a bmp that would help me a lot. Thanks!

0 0

Replies

replied on March 24, 2015

If you are licensed for the SDK, you can see how I created a WorkFlow script activity to create the dynamic stamp image in this post on the old forums

 

https://support.laserfiche.com/ForumsFrames.aspx?Link=viewtopic.php%3ft%3d19621%26amp

0 0
replied on March 24, 2015

I rewrote this in C# and it is significantly shorter. My only issue is applying the stamp. I already have the stamp being created dynamically. It is just the last step of applying the stamp to the page that I need assistance with.

0 0
replied on March 24, 2015 Show version history

From the SDK documentation;


StampInfoReader ListOfStamps = Stamp.EnumPublicStamps(mySess);

foreach (StampInfo SI in ListOfStamps)
{
  if (SI.Name == "New Private Stamp")
  {
    StampAnnotation SA = new StampAnnotation();
    SA.StampId = SI.Id;
    SA.Color = LfColor.FromAbgr(255); // Create a red stamp.
    LfPoint PT = new LfPoint(200, 3000); // position of stamp on the page.
    SA.Position = PT;

    PageInfo PI = Document.GetPageInfo("\\SAMPLE1", 2, mySess);
    PI.AddAnnotation(SA);
  }
}

I had to search a bit to find the LfColor and LfPoint objects; they are in the Laserfiche.RepositoryAccess.Common namespace...

Also note that the name of the stamp the code is looking to apply is the 'New Private Stamp' but the code is enumerating using the EnumPublicStamps method  ;-)

1 0
replied on March 24, 2015

Do you know of anyway to update the stamp. When I am trying to override the byte array it says that the public stamp cannot be modified. Do you have any idea on how to do this?

0 0
replied on March 24, 2015 Show version history

The quick answer is that I have not played with stamps in the SDK.  I do notice that there is an Update method available on the static Stamp object that takes StampInfo as a parameter.  Could you update the appropriate public StampInfo object with its UpdateImageData and Save methods and then call the static Stamp.Update(stampId, stampInfo, session)?

FYI - Nothing in the SDK documentation on this...

0 0
replied on March 24, 2015

Most of the time you will want/need to create a new stamp.  The reason for this is that if you update the image data of the stamp, it will effect all documents with that stamp applied to it.  Most of the time you will want to only effect the stamp being applied to a single document.

0 0
replied on March 25, 2015

I am not familiar with using the SDK to manipulate stamps, but I do know that you cannot edit the stamp themselves (e.g., the image or text of the stamp) in the Laserfiche Client or Web Access either, so I would not expect the SDK to allow this.

You can, however, edit properties of stamps placed on a document (such as color, opacity and rotation) in Web Access and the desktop Client so if that is what you mean by "edit", then that may be possible.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.