Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
482b508b
Commit
482b508b
authored
Oct 22, 2018
by
Kamron Aroonrua
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new dt plugin
parent
a6f35a6b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
5 deletions
+121
-5
Changelog
Changelog
+4
-0
index.js
plugins/dt/dt-pdfmaker/index.js
+13
-0
package.json
plugins/dt/dt-pdfmaker/package.json
+14
-0
perform.js
plugins/dt/dt-pdfmaker/perform.js
+75
-0
vfs_fonts.js
plugins/dt/dt-pdfmaker/vfs_fonts.js
+1
-0
perform.js
plugins/dt/dt-transform/perform.js
+12
-3
version.json
version.json
+2
-2
No files found.
Changelog
View file @
482b508b
#Changelog
## [UR] - 2018-10-22
### Added
- PLUGIN :: dt-pdfmaker
- PLUGIN :: dt-transform ba64script
## [1.2.1] - 2018-10-11
### Added
...
...
plugins/dt/dt-pdfmaker/index.js
0 → 100644
View file @
482b508b
var
util
=
require
(
'util'
);
var
DTPlugin
=
require
(
'../dt-plugin'
);
function
DTTask
(
context
,
request
){
DTPlugin
.
call
(
this
,
context
,
request
);
this
.
name
=
"pdfmaker"
;
this
.
output_type
=
""
;
}
util
.
inherits
(
DTTask
,
DTPlugin
);
DTTask
.
prototype
.
perform
=
require
(
'./perform'
);
module
.
exports
=
DTTask
;
plugins/dt/dt-pdfmaker/package.json
0 → 100644
View file @
482b508b
{
"name"
:
"dt-pdfmaker"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"index.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"pdfmake"
:
"^0.1.38"
}
}
plugins/dt/dt-pdfmaker/perform.js
0 → 100644
View file @
482b508b
var
vm
=
require
(
'vm'
);
var
ctx
=
require
(
'../context'
);
var
Utils
=
ctx
.
getLib
(
'lib/util/plugin-utils'
);
var
pdfMake
=
require
(
'pdfmake/build/pdfmake.js'
)
var
pdfFonts
=
require
(
'./vfs_fonts.js'
);
pdfMake
.
vfs
=
pdfFonts
.
pdfMake
.
vfs
;
pdfMake
.
fonts
=
{
THSarabunNew
:
{
normal
:
'THSarabunNew.ttf'
,
bold
:
'THSarabunNew-Bold.ttf'
,
italics
:
'THSarabunNew-Italic.ttf'
,
bolditalics
:
'THSarabunNew-BoldItalics.ttf'
}
};
function
perform_function
(
context
,
request
,
response
){
var
job_id
=
context
.
jobconfig
.
job_id
;
var
transaction_id
=
context
.
transaction
.
id
;
var
param
=
context
.
task
.
config
.
param
;
var
memstore
=
context
.
task
.
memstore
var
in_type
=
request
.
input_type
;
var
in_data
=
request
.
data
;
var
in_meta
=
request
.
meta
;
var
mapscr
=
Utils
.
parse_script_param
(
param
.
script
);
var
doc
=
in_data
;
if
(
typeof
param
.
document
==
'object'
){
doc
=
param
.
document
;
}
if
(
typeof
param
.
document
==
'string'
){
mapscr
=
mapscr
+
"; document="
+
param
.
document
;
}
var
mapenv
=
{
'src'
:
{
'type'
:
in_type
,
'data'
:
in_data
,
'meta'
:
in_meta
},
'type'
:
in_type
,
'data'
:
in_data
,
'meta'
:
in_meta
,
'document'
:
doc
}
var
script
=
new
vm
.
Script
(
mapscr
);
var
context
=
new
vm
.
createContext
(
mapenv
);
script
.
runInContext
(
context
);
var
meta
=
mapenv
.
meta
;
var
dd
=
mapenv
.
document
;
var
output_type
=
'binary'
;
if
(
!
dd
.
defaultDtyle
){
dd
.
defaultStyle
=
{
font
:
'THSarabunNew'
}
}
else
{
dd
.
defaultStyle
.
font
=
'THSarabunNew'
;
}
var
pdfDocGenerator
=
pdfMake
.
createPdf
(
dd
);
pdfDocGenerator
.
getBase64
((
buf
)
=>
{
var
data
=
Buffer
.
from
(
buf
,
'base64'
);
response
.
success
(
data
,{
'meta'
:
meta
,
'output_type'
:
output_type
});
});
}
module
.
exports
=
perform_function
;
plugins/dt/dt-pdfmaker/vfs_fonts.js
0 → 100644
View file @
482b508b
This diff is collapsed.
Click to expand it.
plugins/dt/dt-transform/perform.js
View file @
482b508b
...
...
@@ -14,9 +14,10 @@ function perform_function(context,request,response){
var
mapscr
=
Utils
.
parse_script_param
(
param
.
script
);
var
datascr
=
param
.
text
;
var
ba64script
=
param
.
ba64script
;
if
(
param
.
text
){
mapscr
=
mapscr
+
"; data=`"
+
param
.
text
+
"`"
;
if
(
datascr
){
mapscr
=
mapscr
+
"; data=`"
+
datascr
+
"`"
;
}
var
mapenv
=
{
...
...
@@ -25,13 +26,21 @@ function perform_function(context,request,response){
'data'
:
in_data
,
'meta'
:
in_meta
},
'_env'
:{},
'type'
:
in_type
,
'data'
:
in_data
,
'meta'
:
in_meta
}
var
script
=
new
vm
.
Script
(
mapscr
);
var
context
=
new
vm
.
createContext
(
mapenv
);
if
(
ba64script
&&
typeof
ba64script
==
'string'
){
var
strScript
=
Buffer
.
from
(
ba64script
,
'base64'
).
toString
(
'utf8'
);
var
b64s
=
new
vm
.
Script
(
strScript
);
b64s
.
runInContext
(
context
);
}
var
script
=
new
vm
.
Script
(
mapscr
);
script
.
runInContext
(
context
);
var
data
=
mapenv
.
data
;
...
...
version.json
View file @
482b508b
{
"version"
:
"1.2.
1
"
,
"build"
:
"201810
1116
00"
"version"
:
"1.2.
2
"
,
"build"
:
"201810
2211
00"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment