4.1 Print Pipeline IDocument is now IDocumentInfo

Discussions related to custom development with Select.
Post Reply
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

4.1 Print Pipeline IDocument is now IDocumentInfo

Post by ckootg »

Prior to 4.1 we used the IPrintJobItem.Properties["Document"], which returned a IDocument object where we could the Group field. In 4.1, the object is now IDocumentInfo and it no longer contains the Group field. How do we get the Group field in 4.1?
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: 4.1 Print Pipeline - Where to find Group on IDocumentInf

Post by ckootg »

Anyone can help me with this?

I'll rephrase the question.

I'm looking for the "Group" field that was once on the IDocument object off of the print item property "Document". The Document property is now returning IDocumentInfo, which doesn't include the Group field.
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: 4.1 Print Pipeline IDocument is now IDocumentInfo

Post by BobRichards »

Which properties from the IDocumentGroup interface do you need?
Bob Richards, Senior Software Developer, SoftPro
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: 4.1 Print Pipeline IDocument is now IDocumentInfo

Post by ckootg »

I need the Description.
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: 4.1 Print Pipeline IDocument is now IDocumentInfo

Post by ckootg »

It doesn't have to be the Description. I just need a unique identifier that indicates that the document came from a certain folder.

For example, if I have the following folder structure, and I drag Document Folder 1 and Document 3 to print, I want to know that Document 1 & 2 came from the same folder, while Document 3 is from another folder. The purpose is to merge and save Document 1 & 2 as one document.

Code: Select all

Document Folder 1
  |_ Document 1
  |_ Document 2

Document Folder 2
  |_ Document 3
  |_ Document 4
I see the new IDocumentTree* interfaces. Is there a way to associate the Document (IDocumentInfo) to the tree?
yatin.t
Posts: 24
Joined: Tue Jan 07, 2014 9:40 am
Location: Raleigh, NC

Re: 4.1 Print Pipeline IDocument is now IDocumentInfo

Post by yatin.t »

The IDocumentGroup interface has been removed from the documents API in 4.1. We apologize for the inconvenience but that interface was not really utilized in a meaningful way by Select, especially in version 3.0 and up. Select 2.6 used it to determine the order in which documents were printed but the functionality related to printing order was completely revised in 3.0.

We also stopped persisting an instance of the "heavier", IDocument instance on the printjob item object in Select 4.1. Instead, you should have a reference to the lighter, IDocumentInfo. The IDocumentInfo.Identifier data structure should give you information like the Name, Version and Classification of the document. The consumer can use that information to query the IDocumentManager API and load the corresponding IDocument object. This object would contain the binary content of the document and so forth.

Code: Select all

SelectServer sps = GetService<SelectServer>();
IDocumentManager documentManager = sps.GetService<IDocumentManager>();
IDocument document = documentManager.GetDocument(documentInfo.Identifier);
If you need information on WHERE a given document is positioned in a tree, I would:
A. Query IDocumentManager.DocumentTrees to load document trees that may contain the given document.

Code: Select all

// ask the API to get document trees ("light-weight" representation) that may have the document
var documentTreeInfos = documentManager.DocumentTrees
                                      .HavingDocument(documentInfo.Identifier.Name)
                                      .Where(tree => tree.Enabled).ToList();

// load the "heavy-weight" representation of each document tree for the corresponding info object 
// so you can work with the arrangement of folders and items in the tree
var documentTrees = new List<IDocumentTree>();
documentTreeInfos.ForEach(t => documentTrees.Add(documentManager.GetDocumentTree(t)));
B. Iterate over IDocumentTree.Root.Children by using a combination of Linq and recursion and determine what folder a given IDocumentInfo belongs to.

Code: Select all

private bool TreeNodeContainsDocument(IDocumentTreeNode node, IDocumentInfo document)
{
    if (node is IDocumentTreeItem)
    {
        return ((IDocumentTreeItem)node).Name.IndexOf(document.Name, StringComparison.OrdinalIgnoreCase) > -1;
    }
    else if (node is IDocumentTreeFolder)
    {
        foreach (var child in ((IDocumentTreeFolder)node).Children)
        {
            if (TreeNodeContainsDocument(child, document))
            {
                return true;
            }
        }
    }
    return false;
}
Hope this helps!
Yatin Tawde
Softpro
Software Engineer
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: 4.1 Print Pipeline IDocument is now IDocumentInfo

Post by ckootg »

Thanks. Exactly what I was looking for.
Post Reply