node-red-contrib-pdf-hummus
Version:
Extract Text from a pdf using hummusjs
90 lines (79 loc) • 2.8 kB
HTML
<!--
Copyright 2017 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="pdf-hummus">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
<input type="text" id="node-input-filename" placeholder="">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-split"style="display: inline-block; width: auto; vertical-align: top;"></input>
<label for="node-input-split" style="width: 70%;">
<i class="fa fa-code-fork"></i> Split into pages</label>
</div>
</script>
<script type="text/x-red" data-help-name="pdf-hummus">
<p>This node splits text out of a PDF document making use of the
npm module hummusjs and the text extraction sample. </p>
<p><b>Usage</b></p>
<p>The node needs a filename and a PDF input buffer as input.
</p>
<p>The output is a json object on <code>msg.payload</code></p>
<p>If the split option is selected then an event is sent for each page.</p>
<p>The filename being written to can be overridden by setting
<code>msg.filename</code></p>
<p>The document to be added should be passed in as a data buffer
in <code>msg.payload</code>
</p>
</script>
<style type="text/css">
.node_label_white {
fill: white;
}
#palette_node_pdf-hummus>div.palette_label {
color: white;
}
</style>
<script type="text/javascript">
(function() {
RED.nodes.registerType('pdf-hummus', {
category: 'function',
defaults: {
name: { value: '' },
filename: {value: ''},
split : {value: true},
mode: { value: {value:'asBuffer'} }
},
credentials: {
token: {
type: 'text'
}
},
color: 'rgb(50,150,50)',
inputs: 1,
outputs: 1,
paletteLabel: 'pdf hummus',
icon: 'file.png',
label: function() {
return this.name || 'pdf hummus';
},
labelStyle: function() {
return this.name ? 'node_label_italic node_label_white' : 'node_label_white';
}
});
})();
</script>