Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pagedjs-cli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Wim Yedema
pagedjs-cli
Commits
cf99cdd8
Commit
cf99cdd8
authored
Apr 03, 2019
by
Wim Yedema
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pagedjs from require
parent
7ccd8672
Pipeline
#228
failed with stages
in 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
index.js
index.js
+7
-6
No files found.
index.js
View file @
cf99cdd8
...
...
@@ -11,9 +11,9 @@ const app = express();
const
PORT
=
9999
;
let
d
ir
=
process
.
cwd
();
let
scriptPath
=
path
.
resolve
(
dir
,
"
./node_modules/pagedjs/dist/
"
);
let
currentD
ir
=
process
.
cwd
();
let
pagedjsPath
=
require
.
resolve
(
'
pagedjs
'
)
let
scriptPath
=
path
.
resolve
(
pagedjsPath
,
'
../../dist
'
)
const
PDF_SETTINGS
=
{
printBackground
:
true
,
...
...
@@ -42,12 +42,13 @@ class Printer extends EventEmitter {
}
async
serve
(
input
)
{
let
relativePath
=
path
.
resolve
(
d
ir
,
input
);
let
relativePath
=
path
.
resolve
(
currentD
ir
,
input
);
let
dirname
=
path
.
dirname
(
relativePath
);
app
.
use
(
"
/print
"
,
express
.
static
(
dirname
))
let
scriptPath
=
path
.
resolve
(
dir
,
"
./node_modules/pagedjs/dist/
"
);
let
pagedjsPath
=
require
.
resolve
(
'
pagedjs
'
)
let
scriptPath
=
path
.
resolve
(
pagedjsPath
,
'
../../dist
'
)
app
.
use
(
"
/polyfill
"
,
express
.
static
(
scriptPath
))
app
.
set
(
'
port
'
,
process
.
env
.
PORT
||
0
);
...
...
@@ -74,7 +75,7 @@ class Printer extends EventEmitter {
let
server
=
await
this
.
serve
(
input
);
let
port
=
server
.
address
().
port
;
let
relativePath
=
path
.
resolve
(
d
ir
,
input
);
let
relativePath
=
path
.
resolve
(
currentD
ir
,
input
);
let
basename
=
path
.
basename
(
relativePath
);
await
page
.
goto
(
`http://localhost:
${
port
}
/print/
${
basename
}
`
)
...
...
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