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

Question

Question

Separate documents based on document size

asked on December 17, 2018

Trying to figure out if there is something in QF or even WF that would allow me to separate documents based on the files total size. We have a client that must keep the total document size under 80mb, so this could mean 20 pages or even 50 pages as long as the total document size is under 80mb.  Seems like I am able to accomplish this by an individual page size, but not the entire document.  Anyone ever done something like this before?

0 0

Replies

replied on December 17, 2018

I'd say your best bet is probably going to be an SDK Script in Workflow. You can use the script to get the exact size of each page, including text, and loop through to determine where to break it up.

The following code will iterate through each page of the document and calculate the total size so you can break the document into chunks of less than 80MB.

// Get source document
DocumentInfo doc = (DocumentInfo)this.BoundEntryInfo;

long docSize = 0;
long sizeLimit = 83886080;

// Read values of each page
PageInfoReader pageReader = doc.GetPageInfos();
foreach (PageInfo page in pageReader){
    // get total size of current page counting image and text
    long pageSize = page.ImageDataSize + page.TextDataSize;

    // if adding the new page will not exceed 80MB
    if((docSize + pageSize) < sizeLimit){
        // add to current document page size
        docSize += pageSize;
    }
    else {
        // split document
    }
}

Obviously not a complete solution, but it should get you pointed in the right direction.

1 0
replied on December 17, 2018

Hi Derick

I'm assuming your documents are tiff images. When a new document is "created" in the repository, you could Run workflow to check the file size and then split the document if it was greater than 80MB.

Under Find Entry> Properties> select Total Document Size and Page Count so these items will be available in your workflow to create conditions.

When documents are to large, use Move Pages to split the documents

 

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

Sign in to reply to this post.