实际上,我需要获取文档的宽度和高度,以及不使用.extension来获取pdf或word或.exe的文档类型。
programattecially我需要读取angularjs中的文件类型和文件维度。
任何人都请告诉解决方案&我的代码如下:
$scope.demofun = function () {
var allowedFormats = ['jpeg', 'jpg', 'png','pdf'];
var unsupportedSizes=false;
if ($scope.file1[0].size < (5 * 1024 * 1024)) {
//这里我将检查文件大小并限制文件,如果大小不符合我的条件。
//上传时我只需要允许A4尺寸的pdf,我想获得pdf文档的尺寸,但我无法获得pdf的尺寸
为此我写了这样的代码,但它不会起作用:
if(($scope.file1[0].width >=21 && $scope.file1[0].width <=22) && ($scope.file1.height >=29.7 && $scope.file1.height <=30.7)){
如何以角度读取尺寸?