小编Plo*_*ouf的帖子

如何从扫描的pdf中提取图像

我使用 Tesseract 从扫描的 PDF 中提取文本。其中一些文件还包含图像。有没有办法得到这些图像?

我通过将它们转换为 tiff 文件来为 tesseract 准备我的扫描 pdf。但是我找不到任何命令行工具来从中提取图像,就像 pdfimages 对“文本”pdf 所做的那样。

任何可以帮助我完成工作的工具(或工具组合)的想法?

pdf image

5
推荐指数
1
解决办法
2511
查看次数

Vue.js 中 v-if 和 v-for 的过滤问题

我在 Vue.js 中的 v-if 中使用的计算属性上遇到了麻烦。找不到解决或重构此问题的方法。一些指示将受到欢迎。

上下文:我显示数组(使用 Axios 生成)中的各种元素,并且在模板的每个 div 中,我获取该数组的一个元素的值。它工作没有任何问题。

问题:数组的某些元素是空的,对于这些元素,我想要么不显示任何内容,要么在某些情况下显示具有通用内容的替代 div。这就是我遇到问题的地方。我使用计算属性来检查数组的元素是否为空。然后我在 v-if 中使用这个计算结果。

代码:(替换内容就是这种情况)

methods: {
    getItem() {
          axios.get('http://4.4.4.4/api/table?&filter[where][name]=' + this.txtInput).then(response => {
            this.items = response.data
          })
    this.txtInput=''
    } 
} 
Run Code Online (Sandbox Code Playgroud)

计算属性的灵感来自于这里的第二个答案):

computed: {
 nonNullArticle: function() {
      return this.items.filter(i => i.article !== null)
    }    
}
Run Code Online (Sandbox Code Playgroud)

并在模板中:

<div v-if="nonNullArticle">
    <div v-for="item in nonNullArticle">{{ item.article }}</div>
</div>

<div v-else>
    <p>alternate content</p>
</div>
Run Code Online (Sandbox Code Playgroud)

vue.js vue-directives

5
推荐指数
1
解决办法
7433
查看次数

连接结束并在脚本中中止命令

我尝试用 node.js (v6.5.0) 制作一个小脚本。此脚本的第一部分显示在列表中随机找到的单词。然后它使用单词(作为键)显示其值(翻译)。该脚本需要 node-redis 模块。我得到的问题似乎与函数的异步性质有关。是不是因为第一个函数是异步的,我不能在嵌套函数中重用参数?我被困住了,一些方向将不胜感激。

这是代码的片段...

var redis = require('redis');
var fs = require('fs');

var client = redis.createClient();
client.on('connect', function() {
});                        

client.randomkey(function (err, word) {
    console.log('The question is: ' + word); 

    client.get('word', function(err, reply) {
        if (err) {
            console.log(err);
        }  
        //otherwise show the value of this key.
    });
});

client.quit();
Run Code Online (Sandbox Code Playgroud)

...这是我在启动命令节点drill.js时收到的错误消息

The question is: chicken
{ AbortError: Stream connection ended and command aborted. It might have been processed.
    at RedisClient.flush_and_error (...thesaurus/node_modules/redis/index.js:350:23)
    at RedisClient.connection_gone (...thesaurus/node_modules/redis/index.js:585:14)
    at Socket.<anonymous> …
Run Code Online (Sandbox Code Playgroud)

node.js

3
推荐指数
1
解决办法
7763
查看次数

标签 统计

image ×1

node.js ×1

pdf ×1

vue-directives ×1

vue.js ×1