Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 1.65 KB

get-file-size.md

File metadata and controls

42 lines (26 loc) · 1.65 KB
layout title keywords description needAutoGenerateSidebar
default-layout
How to get the file size in the specified format
dynamic .net twain, get file size
How to get the file size in the specified format
true

How to get the file size in the specified format by index

From version 7.0

  • In JPG, BMP, PNG, TIF

    You can use the method GetImageSizeWithSpecifiedType to get the file size in JPG, BMP, PNG, TIF.

    For example,

    m_ImageCore = new ImageCore();
    
    int FileSizeinJPG = m_ImageCore.IO.GetImageSizeWithSpecifiedType(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, EnumImageFileFormat.WEBTW_JPG); //Calculates the file size in JPG for the current image.
  • In PDF

    Since PDF Module has been separated from version 7.0, the supported format for GetImageSizeWithSpecifiedType does not include PDF.

    If you want to get the file size in PDF format, please follow the steps below.

    Step1: Download Dynamsoft.Core.Util.cs and add it to the solution.

    Step2: Refer to the sample code.

    m_ImageCore = new ImageCore();
    m_PDFCreator = new PDFCreator();
    
    int FileSizeinPDF = Dynamsoft.Core.Util.GetImageSizeWithSpecifiedType(m_ImageCore, m_PDFCreator, m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, EnumImageFileFormatEx.WEBTW_PDF); //Calculates the file size in PDF for the current image.