Files
dev 33d7c9c46a Translate user-facing docs and node help to English
README, NODES.md, install scripts, palette help text, and example flows — node .js logic unchanged.
2026-08-22 17:36:38 +02:00

66 lines
2.7 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType('collabora-convert', {
category: 'nextcloud collabora',
color: '#7950a2',
defaults: {
name: { value: '' },
config: { type: 'nc-collab-config', required: true },
operation: { value: 'convert' },
format: { value: 'pdf' }
},
inputs: 1,
outputs: 1,
icon: 'font-awesome/fa-file-pdf-o',
label: function () {
return this.name || `convert → ${this.format}`;
}
});
</script>
<script type="text/html" data-template-name="collabora-convert">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-config"><i class="fa fa-cog"></i> Config</label>
<input type="text" id="node-input-config">
</div>
<div class="form-row">
<label for="node-input-format"><i class="fa fa-file"></i> Format</label>
<select id="node-input-format">
<option value="pdf">pdf</option>
<option value="png">png</option>
<option value="docx">docx</option>
<option value="odt">odt</option>
<option value="html">html</option>
<option value="txt">txt</option>
<option value="xlsx">xlsx</option>
<option value="pptx">pptx</option>
</select>
</div>
</script>
<script type="text/html" data-help-name="collabora-convert">
<p><strong>Convert a file to another format.</strong> Sends a document to CODE and returns binary data (pdf, png, docx, odt, html, xlsx, pptx …). Does not save to Nextcloud — result is <code>msg.payload</code> as a Buffer.</p>
<h4>Input</h4>
<p>File content, in order:</p>
<ol>
<li><code>msg.payload</code> if it's already a Buffer or text</li>
<li>otherwise WebDAV GET of <code>msg.ncPath</code></li>
</ol>
<p>Optional: <code>msg.templateNcPath</code> (template), <code>msg.compareNcPath</code> (compare file).</p>
<h4>Output</h4>
<p>POST multipart to CODE <code>/cool/convert-to/&lt;format&gt;</code>. Field: <code>data</code> = source file.</p>
<p><code>msg.payload</code>, <code>msg.filename</code>, <code>msg.format</code>, <code>msg.contentType</code>, <code>msg.statusCode</code></p>
<h4>When to use</h4>
<p>When you control the next step: save via WebDAV/OCS, email, Talk, or pass on in the flow. For "file in NC → PDF in NC" use <code>collabora-bridge</code> (<code>ncFileToPdf</code>).</p>
<pre>inject { ncPath: "/Documents/contract.docx", format: "pdf" }
→ collabora-convert
→ debug (payload = PDF bytes)</pre>
</script>