Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pagedjs-cli
Manage
Activity
Members
Labels
Plan
Issues
62
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
There was a problem fetching the pipeline stages.
Show more breadcrumbs
pagedjs
pagedjs-cli
Commits
bd9298c4
Commit
bd9298c4
authored
6 years ago
by
Fred Chasen
Browse files
Options
Downloads
Patches
Plain Diff
Update exposeFunction
parent
883d6ca1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#30127
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
bin/paged
+40
-29
40 additions, 29 deletions
bin/paged
test/samples/aurorae/book.css
+14
-0
14 additions, 0 deletions
test/samples/aurorae/book.css
with
55 additions
and
29 deletions
.gitignore
0 → 100644
+
1
−
0
View file @
bd9298c4
node_modules
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bin/paged
+
40
−
29
View file @
bd9298c4
...
...
@@ -38,6 +38,8 @@ let relativePath = path.resolve(dir, input);
let
output
;
let
tmpFile
,
tmpPath
;
let
headless
=
typeof
program
.
debug
===
"
undefined
"
;
// var hyphenator;
// var hyphenateOptions;
...
...
@@ -66,8 +68,6 @@ if (typeof(program.output) === "string") {
output
=
"
output.pdf
"
;
}
console
.
log
(
"
output
"
,
output
,
program
.
output
);
/*
if (program.hyphenate) {
hyphenateOptions = {
...
...
@@ -96,7 +96,7 @@ if (program.hyphenate) {
(
async
()
=>
{
const
browser
=
await
puppeteer
.
launch
({
//
headless:
false,
headless
:
headless
// args: ['--no-sandbox', '--allow-file-access-from-files', '--enable-local-file-accesses']
});
...
...
@@ -113,36 +113,47 @@ if (program.hyphenate) {
let
server
=
app
.
listen
(
PORT
);
await
page
.
goto
(
`http://localhost:
${
PORT
}
/print/
${
basename
}
`
);
await
page
.
goto
(
`http://localhost:
${
PORT
}
/print/
${
basename
}
?preview=true
`
);
await
page
.
addScriptTag
(
{
url
:
`http://localhost:
${
PORT
}
/polyfill/paged.polyfill.js`
await
page
.
exposeFunction
(
'
PuppeteerLogger
'
,
(
msg
,
counter
)
=>
{
console
.
log
(
msg
,
counter
);
});
await
page
.
exposeFunction
(
'
onPagesRendered
'
,
async
(
msg
,
width
,
height
,
orientation
)
=>
{
console
.
log
(
msg
);
console
.
log
(
"
Saved to
"
,
output
);
let
pdf
=
await
page
.
pdf
({
path
:
output
,
printBackground
:
true
,
displayHeaderFooter
:
false
,
width
:
width
,
height
:
height
,
orientation
:
orientation
,
margin
:
{
top
:
0
,
right
:
0
,
bottom
:
0
,
left
:
0
,
},
// format: 'A4'
}).
catch
((
e
)
=>
{
console
.
error
(
e
);
})
server
.
close
();
await
browser
.
close
();
console
.
log
(
msg
,
width
,
height
,
orientation
);
if
(
headless
)
{
let
pages
=
await
page
.
waitForSelector
(
"
.pages
"
);
let
pdf
=
await
page
.
pdf
({
path
:
output
,
printBackground
:
true
,
displayHeaderFooter
:
false
,
width
:
width
,
height
:
height
,
orientation
:
orientation
,
margin
:
{
top
:
0
,
right
:
0
,
bottom
:
0
,
left
:
0
,
},
// format: 'A4'
}).
catch
((
e
)
=>
{
console
.
error
(
e
);
});
console
.
log
(
"
Saved to
"
,
output
);
server
.
close
();
await
browser
.
close
();
}
});
await
page
.
addScriptTag
({
url
:
`http://localhost:
${
PORT
}
/polyfill/paged.polyfill.js`
});
})();
This diff is collapsed.
Click to expand it.
test/samples/aurorae/book.css
+
14
−
0
View file @
bd9298c4
...
...
@@ -158,6 +158,20 @@ section[data-type="epigraph"],
font-variant-numeric
:
oldstyle-nums
;
}
.shorter
:nth
(
1
)
{
position
:
running
(
shorter1
);
}
.shorter
:nth
(
2
)
{
position
:
running
(
shorter2
);
}
.page
:nth
(
1
)
{
content
:
--var-1
;
}
--var-1
=
dataurl
:svg
/* flexbox */
section
[
data-type
=
"copyright"
]
#flexbox
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment