Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
html2pdf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Lukas Niegsch
html2pdf
Commits
2cc58b53
Commit
2cc58b53
authored
Jul 20, 2022
by
lukas.niegsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished dynamic api for methods
parent
67150aa0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
193 additions
and
139 deletions
+193
-139
gadget_converter.html
gadget_converter.html
+2
-2
gadget_converter.js
gadget_converter.js
+34
-21
gadget_devtools.js
gadget_devtools.js
+157
-116
No files found.
gadget_converter.html
View file @
2cc58b53
...
...
@@ -9,8 +9,8 @@
</head>
<body>
<div
data-gadget-url=
"gadget_
browser
.html"
data-gadget-scope=
"
browser
"
data-gadget-url=
"gadget_
devtools
.html"
data-gadget-scope=
"
devtools
"
data-gadget-sandbox=
"public"
>
</div>
</body>
...
...
gadget_converter.js
View file @
2cc58b53
...
...
@@ -31,33 +31,46 @@
rJS
(
window
)
.
declareMethod
(
"
convert
"
,
function
(
html
)
{
var
gadget
=
this
;
var
browser
;
var
page
;
var
devtools
;
var
targetId
;
var
frameId
;
var
base64data
;
return
gadget
.
getDeclaredGadget
(
"
browser
"
)
/**
* Steps:
*
* // new page setup
* Target.createTarget();
* Target.attachToTarget();
* Target.activateTarget();
*
* // enable events
* Network.enable();
* Page.enable();
*
* // change content
* Page.frameAttached();
* Page.setDocumentContent();
* Page.loadEventFired(); // Is this event fired once loading starts or stops?
*
* // convert html to pdf
* Page.printToPDF();
*
* // cleanup
* Target.detachFromTarget();
* Target.closeTarget();
*/
return
gadget
.
getDeclaredGadget
(
"
devtools
"
)
.
push
(
function
(
subgadget
)
{
browser
=
subgadget
;
return
browser
.
openNewPage
(
"
http://www.example.com
"
);
return
subgadget
.
getDevtools
();
})
.
push
(
function
(
result
)
{
page
=
result
;
return
browser
.
setPageContent
(
page
,
html
);
})
.
push
(
function
()
{
return
browser
.
getVersion
();
})
.
push
(
function
()
{
return
browser
.
enablePage
(
page
);
})
.
push
(
function
()
{
return
browser
.
printToPdf
(
page
,
optionsForPrintToPdf
);
devtools
=
result
;
return
devtools
.
Browser
.
getVersion
();
})
.
push
(
function
(
result
)
{
base64data
=
result
;
return
browser
.
closePage
(
page
);
})
.
push
(
function
()
{
return
base64data
;
console
.
log
(
result
);
})
})
}(
window
,
rJS
));
\ No newline at end of file
gadget_devtools.js
View file @
2cc58b53
This diff is collapsed.
Click to expand it.
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