2026-08-22 14:56:38 +02:00
< script type = "text/javascript" >
RED . nodes . registerType ( 'collabora-convert' , {
category : 'nextcloud collabora' ,
2026-08-22 17:10:34 +02:00
color : '#7950a2' ,
2026-08-22 14:56:38 +02:00
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" >
2026-08-22 17:36:38 +02:00
< label for = "node-input-name" > < i class = "fa fa-tag" > < / i > N a m e < / l a b e l >
2026-08-22 14:56:38 +02:00
< input type = "text" id = "node-input-name" >
< / d i v >
< div class = "form-row" >
< label for = "node-input-config" > < i class = "fa fa-cog" > < / i > C o n f i g < / l a b e l >
< input type = "text" id = "node-input-config" >
< / d i v >
< div class = "form-row" >
< label for = "node-input-format" > < i class = "fa fa-file" > < / i > F o r m a t < / l a b e l >
< select id = "node-input-format" >
< option value = "pdf" > pdf < / o p t i o n >
< option value = "png" > png < / o p t i o n >
< option value = "docx" > docx < / o p t i o n >
< option value = "odt" > odt < / o p t i o n >
< option value = "html" > html < / o p t i o n >
< option value = "txt" > txt < / o p t i o n >
< option value = "xlsx" > xlsx < / o p t i o n >
< option value = "pptx" > pptx < / o p t i o n >
< / s e l e c t >
< / d i v >
< / script >
< script type = "text/html" data-help-name = "collabora-convert" >
2026-08-22 17:36:38 +02:00
< p > < strong > Convert a file to another format . < / s t r o n g > S e n d s a d o c u m e n t t o C O D E a n d r e t u r n s b i n a r y d a t a ( p d f , p n g , d o c x , o d t , h t m l , x l s x , p p t x … ) . D o e s n o t s a v e t o N e x t c l o u d — r e s u l t i s < c o d e > m s g . p a y l o a d < / c o d e > a s a B u f f e r . < / p >
2026-08-22 17:10:34 +02:00
2026-08-22 17:36:38 +02:00
< h4 > Input < / h 4 >
< p > File content , in order : < / p >
2026-08-22 17:10:34 +02:00
< ol >
2026-08-22 17:36:38 +02:00
< li > < code > msg . payload < / c o d e > i f i t ' s a l r e a d y a B u f f e r o r t e x t < / l i >
< li > otherwise WebDAV GET of < code > msg . ncPath < / c o d e > < / l i >
2026-08-22 17:10:34 +02:00
< / o l >
2026-08-22 17:36:38 +02:00
< p > Optional : < code > msg . templateNcPath < / c o d e > ( t e m p l a t e ) , < c o d e > m s g . c o m p a r e N c P a t h < / c o d e > ( c o m p a r e f i l e ) . < / p >
2026-08-22 17:10:34 +02:00
2026-08-22 17:36:38 +02:00
< h4 > Output < / h 4 >
< p > POST multipart to CODE < code > / c o o l / c o n v e r t - t o / & l t ; f o r m a t & g t ; < / c o d e > . F i e l d : < c o d e > d a t a < / c o d e > = s o u r c e f i l e . < / p >
2026-08-22 17:10:34 +02:00
< p > < code > msg . payload < / c o d e > , < c o d e > m s g . f i l e n a m e < / c o d e > , < c o d e > m s g . f o r m a t < / c o d e > , < c o d e > m s g . c o n t e n t T y p e < / c o d e > , < c o d e > m s g . s t a t u s C o d e < / c o d e > < / p >
2026-08-22 17:36:38 +02:00
< h4 > When to use < / h 4 >
< 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 < / c o d e > ( < c o d e > n c F i l e T o P d f < / c o d e > ) . < / p >
2026-08-22 17:10:34 +02:00
2026-08-22 17:36:38 +02:00
< pre > inject { ncPath : "/Documents/contract.docx" , format : "pdf" }
2026-08-22 17:10:34 +02:00
→ collabora - convert
2026-08-22 17:36:38 +02:00
→ debug ( payload = PDF bytes ) < / p r e >
2026-08-22 14:56:38 +02:00
< / script >