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

Question

Question

How do you get the file size for a native Laserfiche document using the .NET SDK?

asked on January 4, 2023

I am running into an issue where the ElecDocumentSize for native Laserfiche documents is coming back as 0 bytes in the DocumentInfo (screenshot attached).  I do not see another property on the DocumentInfo with the filesize.  Is there away to get the file size for native Laserfiche documents using the .NET SDK?  Non-native/electronic documents are returning the file size in the ElecDocumentSize, but native documents are not.  I have a case where we are getting a list of documents via a search and then displaying the results in a list and the filesize is one of the desired columns to display to the users.  I noticed in the Laserfiche Web Client that the user is required to click a "Calculate file size" link to get the size to display as a field, which leads me to think there may be an API to calculate the file size, but I have not found one and am looking for assistance.

image (30).png
image (30).png (69.1 KB)
1 0

Answer

SELECTED ANSWER
replied on January 4, 2023

There are a couple options:

1. Retrieve the PageInfos with doc.GetPageInfos() and add up the size of the page parts (this does not include the edoc size):

long totalSize = 0;

foreach (PageInfo page in doc.GetPageInfos())
{
    totalSize += page.TextDataSize;
    totalSize += page.ImageDataSize;
    totalSize += page.LocationsDataSize;
    totalSize += page.ThumbnailDataSize;
}

2. Use the TotalDocSize entry listing column:

EntryListingSettings listingParams = new EntryListingSettings();
listingParams.AddColumn(SystemColumn.TotalDocSize);

using (SingleEntryListing listing = new SingleEntryListing(docId, listingParams, session))
{
    long totalSize = (long)listing.GetDatum(1, SystemColumn.TotalDocSize);
}

 

1 0
replied on January 4, 2023

Just what I needed!  Works great!  Thank you!

0 0

Replies

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

Sign in to reply to this post.