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;








1















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










share|improve this question


























  • 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


















1















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










share|improve this question


























  • 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














1












1








1


1






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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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

















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













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
);



);













draft saved

draft discarded


















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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해