#I want to convert it to pdf
1 messages ยท Page 1 of 1 (latest)
You can easily convert that to markdown, each chapter title/subchapter having its own heading level and adding pagebreaks after each subchapter/chapter
You can iterate through it and create a string
I'm assuming you already know markdown?
Anyways, there are python libraries that can take markdown and convert it into PDFs
I am out rn. Actually, I made this when I was at home on my pc a few hrs ago. We had to go to someone's wedding today, so I cannot do it. Can you help me?
And yk, pydroid3 is shit
Can only be used to run codes
for future tasks you can use termux and edit the code in any editor you'd like, but termux allows you to have a whole command line
packages and stuff
handy
Yeha. But i was getting errors downloading pip packages
with termux?
Yeah
that's weird...
Ik.
Anyways, it's possible to do all of this easily
And you don't even need a library to convert to PDFs
Some sites do that
so all you need to do
is add a neat little hashtag behind chapter titles
and some newlines
From json to pdf?
yep
Hmm
I'll find out
Thanks man for the suggestion
You want source code?
@dark grail
of?
No it's fine ๐
Lol
Programmers require hydration ๐
But yes I'm back
So this book, you didn't do it through makersuite or bard?
You made a whole program for it?
You there @meager niche ?
Well that's a shame, I was just stalling ๐
Now it'll be a while until you see this @meager niche ๐
import json
book : list[dict[str,str]] = json.load(open("The Train Of Lost Souls.json", 'r'))
output = "# The Train Of Lost Souls\n\n### By @emperorayush\n\n<div style=\"page-break-after: always\"></div>\n\n"
for chapter in book:
title = chapter["chapter_title"]
subchapters : list[dict[str,str]] = chapter["subchapters"]
output+=f"## {title}\n\n"
for subchapter in subchapters:
subchapter_title = subchapter["subchapter"]
subchapter_content = subchapter["content"]
output+=f"### {subchapter_title} \n\n {subchapter_content} \n\n"
output+="<div style=\"page-break-after: always\"></div>\n\n"
print(output)```
To convert the output markdown I just went to a markdown render site, https://md2pdf.netlify.app/ which opens the Print dialogue - allows you to save as PDF, just hide the footers and headers
Awesome Markdown to PDF! Still upload resume.md to stranger server? Try this Offline Web App!
enjoy ๐