Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pagedjs-cli
Manage
Activity
Members
Labels
Plan
Issues
63
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pagedjs
pagedjs-cli
Merge requests
!2
Use pagedjs from require
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Use pagedjs from require
master
into
master
Overview
1
Commits
1
Pipelines
0
Changes
1
Closed
Boris Budini
requested to merge
master
into
master
6 years ago
Overview
1
Commits
1
Pipelines
0
Changes
1
Expand
This is to fix issue
#2
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
cf99cdd8
1 commit,
6 years ago
1 file
+
7
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
index.js
+
7
−
6
Options
@@ -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
}
`
)