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

Question

Question

Workflow SDK Script - For converting incoming entry from jpeg to tiff

asked on July 15, 2019

Hi, I'm trying to convert incoming entries that may be either jpeg or png format into tiff then import said tiff image into the repository, using the workflow sdk script activity. For the life of me I cannot find any useful documentation with examples specific to workflow sdk. The provided documentation bundled with the workflow sdk is not very helpful and contains no examples. 

 

Below is an example of what I have so far, I basically want incoming jpeg/png to get imported into the repository as tiff format. Can anyone show me a script that will accomplish what i am trying to do? 

 

            // log into the repository
            RepositoryRegistration repository = new RepositoryRegistration(serverName, repoName);
            Session session = new Session();
            session.LogIn(username, password, repository);

            // retrieve some basic properties of the incoming document
            DocumentInfo docInfo = Document.GetDocumentInfo(BoundEntryInfo.Path, session);
            
            // create an empty document entry in the repository to recieve tiff image
            DocumentInfo document = new DocumentInfo(session);
            document.Create("\\Test\\Test\\Temp\\DocumentExportSample", "DEFAULT", EntryNameOption.AutoRename);
            // initalize an instance of DocumentImporter
            DocumentImporter importer = new DocumentImporter();
            // set document
            importer.Document = document;
            // import the tiff 
            importer.ImportImages(docInfo.Path); // fails
            
            session.LogOut();

 

0 0

Replies

replied on July 15, 2019

You should not need to convert it to TIFF first.  Just supply the image to the Document importer and it will save on the backend as a TIFF.

 

The issue with you code is that you are pointing the Document Importer to the LF document object as its source.  Line 17 should be something like

importer.ImportImages(WindowsPathToSourceImage);

 

1 0
replied on July 15, 2019

But the image i want to import is coming the from workflow entry not the filesystem.

0 0
replied on July 15, 2019 Show version history

What do you mean that it is coming from the workflow entry?  If it is the workflow entry, then it is already in Laserfiche and no need to import it.

1 0
replied on July 15, 2019

Please don't make your own connections in Workflow scripts. Use the built-in RASession connection.

Your script likely fails because you are using docInfo.Path, which is the document's location in the repository, where the importer expects the path on disk to the file you want to import.

Is there a reason to convert the JPG to TIFF? Laserfiche can store JPG images as image pages without converting them to TIFF first.

 

0 0
replied on July 15, 2019

Is there documentation or examples on how to use RASession connection, if so where?

 

How would you go about importing a jpeg/png from a workflow entry? 

0 0
replied on July 15, 2019

It's not any different than what you already have except for not having to define the connection yourself (lines 1-4 in your script can be deleted and you replace any reference to "session" with "RASession"):

DocumentInfo document = new DocumentInfo(RASession);

There is no such thing as a "workflow entry". But if you are referring to copying pages from another Laserfiche document, is there a reason why you're not using the built-in Create Entry and Move Pages activities?

1 0
replied on July 16, 2019

I see what you mean now... do we need to log out at the end of our script  if we use an RASession object, or is it done automatically? 

0 0
replied on July 16, 2019

The RASession object is all handled for you.

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

Sign in to reply to this post.