wkhtmltopdf from list of files generates wrong TOC based on H tagsPDFKit and new WKHTMLTOPDF binariespdfkit gem generating pdf links as text (not click-able links)Wkhtmltopdf version, first page and TOCPHP Wkhtmltopdf will not generate more than 41 pagesWKHTMLTOPDF with pdfkit on Rails ignoring table page breaksPDFMerger table of contents lost after merging filesUsing different margins on first page using pdfkit pythonHow to divide a document in sections without showing the <h*> tags when using wkhtmltopdf?Remove specific title from TOC generated from wkhtmltopdfpython-pdfkit (wkhtmltopdf) TOC overflow
Confirming resignation after resignation letter ripped up
Which household object drew this pattern?
when the world is the villain, how do you make it compelling
Singleton Design Pattern implementation in a not traditional way
Would this system work to purify water?
Script that helps people make better choices
If all stars rotate, why was there a theory developed, that requires non-rotating stars?
See details of old sessions
Fancy String Replace
Does norwegian.no airline overbook flights?
Why don't electrons take the shorter path in coils?
1980's sci fi book series, subspace is a sponge, young man in emergency suit can propel himself by sucking in the sponge stuff
Are there account age or level requirements for obtaining special research?
In an emergency, how do I find and share my position?
Can realistic planetary invasion have any meaningful strategy?
Can pay be witheld for hours cleaning up after closing time?
If the first law of thermodynamics ensures conservation of energy, why does it allow systems to lose energy?
Did a flight controller ever answer Flight with a no-go?
Why do all fields in a QFT transform like *irreducible* representations of some group?
Co-author responds to email by mistake cc'ing the EiC
What magic extends life or grants immortality?
Most practical knots for hitching a line to an object while keeping the bitter end as tight as possible, without sag?
LeetCode: Pascal's Triangle C#
Shouldn't the "credit score" prevent Americans from going deeper and deeper into personal debt?
wkhtmltopdf from list of files generates wrong TOC based on H tags
PDFKit and new WKHTMLTOPDF binariespdfkit gem generating pdf links as text (not click-able links)Wkhtmltopdf version, first page and TOCPHP Wkhtmltopdf will not generate more than 41 pagesWKHTMLTOPDF with pdfkit on Rails ignoring table page breaksPDFMerger table of contents lost after merging filesUsing different margins on first page using pdfkit pythonHow to divide a document in sections without showing the <h*> tags when using wkhtmltopdf?Remove specific title from TOC generated from wkhtmltopdfpython-pdfkit (wkhtmltopdf) TOC overflow
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am using python-pdfkit as follows to generate a PDF:
pdfkit.from_file(list_of_files, toc=toc, cover=cover, cover_first=True, options=default_options)
My problem is regarding the table of contents that is generated:
The table of contents is generated based on the H tags in the input
documents
If my html files are like:
index1.html
<h1>Title</h1>
...
[content]
index2.html
<h2>Subtitle</h2>
...
[content]
index3.html
<h3>Sub-subtitle</h3>
...
[content]
Since they are 3 different files, then the generated TOC is:
Title --------------------- Page x
Subtitle ------------------ Page y
Sub-subtitle -------------- Page z
Instead of
Title--------------------- Page x
Subtitle -------------- Page y
Sub-subtitle ------- Page z
I have tried merging all html files together but it is giving me a lot of problems with the internal links... linking to files instead to HTML #IDs gets tricky with a single HTML file all merged.
Any idea how to tell wkhtmltopdf to respect the H tags hierarchy without resetting it per file?
Thanks!
Edit:
After some discussion in the wkhtmltopdf github issues section, the only easy way of achieving this result is pre-parsing the HTML files to merge them all together.
See the following link for more details:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
wkhtmltopdf pdfkit python-pdfkit
add a comment |
I am using python-pdfkit as follows to generate a PDF:
pdfkit.from_file(list_of_files, toc=toc, cover=cover, cover_first=True, options=default_options)
My problem is regarding the table of contents that is generated:
The table of contents is generated based on the H tags in the input
documents
If my html files are like:
index1.html
<h1>Title</h1>
...
[content]
index2.html
<h2>Subtitle</h2>
...
[content]
index3.html
<h3>Sub-subtitle</h3>
...
[content]
Since they are 3 different files, then the generated TOC is:
Title --------------------- Page x
Subtitle ------------------ Page y
Sub-subtitle -------------- Page z
Instead of
Title--------------------- Page x
Subtitle -------------- Page y
Sub-subtitle ------- Page z
I have tried merging all html files together but it is giving me a lot of problems with the internal links... linking to files instead to HTML #IDs gets tricky with a single HTML file all merged.
Any idea how to tell wkhtmltopdf to respect the H tags hierarchy without resetting it per file?
Thanks!
Edit:
After some discussion in the wkhtmltopdf github issues section, the only easy way of achieving this result is pre-parsing the HTML files to merge them all together.
See the following link for more details:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
wkhtmltopdf pdfkit python-pdfkit
This topic is being followed inwkhtmltopdf's github repo github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
– Begoña Álvarez de la Cruz
Apr 10 at 8:08
add a comment |
I am using python-pdfkit as follows to generate a PDF:
pdfkit.from_file(list_of_files, toc=toc, cover=cover, cover_first=True, options=default_options)
My problem is regarding the table of contents that is generated:
The table of contents is generated based on the H tags in the input
documents
If my html files are like:
index1.html
<h1>Title</h1>
...
[content]
index2.html
<h2>Subtitle</h2>
...
[content]
index3.html
<h3>Sub-subtitle</h3>
...
[content]
Since they are 3 different files, then the generated TOC is:
Title --------------------- Page x
Subtitle ------------------ Page y
Sub-subtitle -------------- Page z
Instead of
Title--------------------- Page x
Subtitle -------------- Page y
Sub-subtitle ------- Page z
I have tried merging all html files together but it is giving me a lot of problems with the internal links... linking to files instead to HTML #IDs gets tricky with a single HTML file all merged.
Any idea how to tell wkhtmltopdf to respect the H tags hierarchy without resetting it per file?
Thanks!
Edit:
After some discussion in the wkhtmltopdf github issues section, the only easy way of achieving this result is pre-parsing the HTML files to merge them all together.
See the following link for more details:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
wkhtmltopdf pdfkit python-pdfkit
I am using python-pdfkit as follows to generate a PDF:
pdfkit.from_file(list_of_files, toc=toc, cover=cover, cover_first=True, options=default_options)
My problem is regarding the table of contents that is generated:
The table of contents is generated based on the H tags in the input
documents
If my html files are like:
index1.html
<h1>Title</h1>
...
[content]
index2.html
<h2>Subtitle</h2>
...
[content]
index3.html
<h3>Sub-subtitle</h3>
...
[content]
Since they are 3 different files, then the generated TOC is:
Title --------------------- Page x
Subtitle ------------------ Page y
Sub-subtitle -------------- Page z
Instead of
Title--------------------- Page x
Subtitle -------------- Page y
Sub-subtitle ------- Page z
I have tried merging all html files together but it is giving me a lot of problems with the internal links... linking to files instead to HTML #IDs gets tricky with a single HTML file all merged.
Any idea how to tell wkhtmltopdf to respect the H tags hierarchy without resetting it per file?
Thanks!
Edit:
After some discussion in the wkhtmltopdf github issues section, the only easy way of achieving this result is pre-parsing the HTML files to merge them all together.
See the following link for more details:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
wkhtmltopdf pdfkit python-pdfkit
wkhtmltopdf pdfkit python-pdfkit
edited Apr 10 at 10:23
Begoña Álvarez de la Cruz
asked Mar 26 at 16:47
Begoña Álvarez de la CruzBegoña Álvarez de la Cruz
612 silver badges7 bronze badges
612 silver badges7 bronze badges
This topic is being followed inwkhtmltopdf's github repo github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
– Begoña Álvarez de la Cruz
Apr 10 at 8:08
add a comment |
This topic is being followed inwkhtmltopdf's github repo github.com/wkhtmltopdf/wkhtmltopdf/issues/4310
– Begoña Álvarez de la Cruz
Apr 10 at 8:08
This topic is being followed in
wkhtmltopdf's github repo github.com/wkhtmltopdf/wkhtmltopdf/issues/4310– Begoña Álvarez de la Cruz
Apr 10 at 8:08
This topic is being followed in
wkhtmltopdf's github repo github.com/wkhtmltopdf/wkhtmltopdf/issues/4310– Begoña Álvarez de la Cruz
Apr 10 at 8:08
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362322%2fwkhtmltopdf-from-list-of-files-generates-wrong-toc-based-on-h-tags%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362322%2fwkhtmltopdf-from-list-of-files-generates-wrong-toc-based-on-h-tags%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This topic is being followed in
wkhtmltopdf's github repo github.com/wkhtmltopdf/wkhtmltopdf/issues/4310– Begoña Álvarez de la Cruz
Apr 10 at 8:08