/// /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved. /// /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. /// This notice may not be removed from this file. class CPDFInfo { String fileName = ''; int fileSize = 0; String title = ''; String author = ''; String subject = ''; String creator = ''; String producer = ''; int creationDate = 0; int modificationDate = 0; String keywords = ''; int pageCount = 0; int? majorVersion; CPDFInfo( this.fileName, this.fileSize, this.title, this.author, this.subject, this.creator, this.producer, this.creationDate, this.modificationDate, this.keywords, this.pageCount, this.majorVersion); CPDFInfo.formJson(Map json) { fileName = json['fileName']; fileSize = json['fileSize']; title = json['title']; author = json['author']; subject = json['subject']; creator = json['creator']; producer = json['producer']; creationDate = json['creationDate']; modificationDate = json['modificationDate']; keywords = json['keywords']; pageCount = json['pageCount']; majorVersion = json['majorVersion']; } String fileSizeStr() { int MB = 1024 * 1024; int KB = 1024; num size; String unit = " M"; if (fileSize > MB) { size = (fileSize / (1024 * 1024)); } else if (fileSize > KB) { size = (fileSize / 1024); unit = " KB"; } else { size = fileSize; unit = " B"; } return '${size.toStringAsFixed(2)}$unit'; } }