cancel
Showing results for 
Search instead for 
Did you mean: 

How to put current date time on PDF document?

Harshal_Shravgi
Star Contributor
Star Contributor

We are on OnBase 17 SP1. I want to write a Unity script to be executed from workflow. This script should put below text at top-right corner of the PDF document imported in OnBase.

Text:

FILED

Current Date-Time

I have a custom C#.net program where I could do this using iText 7 library.

Can somebody give me an idea on how to do it in OnBase Unity API script?

I tried using RedactionImageModification but it is not working with PDFs.

1 ACCEPTED ANSWER

Walter_Fernande
Confirmed Champ
Confirmed Champ

Hello Harshall,

If you have Document Import Procesor, you can check in Options/Run Process/Add to Workflow On Commit, then configure in your document / Life Cycles a litle Queue that will execute a Unity Script that you will create as IWorkFlowScript that will (1) Download current document (2) execute your iTextSharp Code to apply your FILED text with Commit datetime (3) update revision . No need to convert to image or someting like that. I forgot to ask if you are a API Certified? so you can access to sdk.onbase.com and read documentation. Feel free to ask if you need more information.

Best wishes from Perú

 

View answer in original post

12 REPLIES 12

Walter_Fernande
Confirmed Champ
Confirmed Champ

Hello Harshall,

If you have Document Import Procesor, you can check in Options/Run Process/Add to Workflow On Commit, then configure in your document / Life Cycles a litle Queue that will execute a Unity Script that you will create as IWorkFlowScript that will (1) Download current document (2) execute your iTextSharp Code to apply your FILED text with Commit datetime (3) update revision . No need to convert to image or someting like that. I forgot to ask if you are a API Certified? so you can access to sdk.onbase.com and read documentation. Feel free to ask if you need more information.

Best wishes from Perú

 

Hi, Thanks for your response. Yes, i am API certified and could access SDK. Could you guide me to an example of updating revision of existing document in SDK? My plan of action:

1. On commit, document enters the workflow

2. Export the document (save out document) to a temporary location

3. Use iText7 library (I ) to at datetime and create a new PDF at temporary location

4. Import this new edited PDF as new revision and may be remove old revision

I need help on point 4. How to do it?

 

Hello Harshal,

Document Parameter is args.Document and fileBarcodePath is the new pdf, fileFormatPDFTemplate = 16

private void CreateRevision(Hyland.Unity.Application app, Hyland.Unity.Document document, string fileBarcodePath) {
FileType fileType = app.Core.FileTypes.Find(long.Parse(fileFormatPDFTemplate));
StoreRevisionProperties props = app.Core.Storage.CreateStoreRevisionProperties(document, fileType);
List<string> fileList = new List<string>();
fileList.Add(fileBarcodePath);
Hyland.Unity.Document renditionDocument = app.Core.Storage.StoreNewRevision(fileList, props);
}

Feel free to reach me at +51 991159446 via whatsapp if you need help.

Best regards.

Thanks, Everything is working as expected but my document now have 2 revisions - one original and the new one with date time stamped. I wrote below below code:

Storage storage = app.Core.Storage;
StoreRevisionProperties storeRevisionProperties = storage.CreateStoreRevisionProperties(args.Document, pdfFileType);
storeRevisionProperties.Comment = "FILED";
List<string> fileList = new List<string>();
fileList.Add(destPath);
Hyland.Unity.Document newDocument = storage.StoreNewRevision(fileList, storeRevisionProperties);

 

After adding this new revision, I want to delete original revision. I don't want my users to see previous revision.  Basically, I want to update the revision and not to add new revision.

I have below document configuration settings -

9c4882b4b0a344ab83a13e38b2ebc845

 

Ok, then you will need to delete your first document and upload a new one but both of them will not be the same document, this new document won't be the "commited" version strickly speaking 😉

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.