Open PEMessage opened 3 years ago
Not at the moment, there are ways to do this, from other programs like Adobe Acrobat. An older version of this tool, using markdown export has a book function, but it doesn't work well. https://github.com/ganeshh123/notion-pdf-export/releases/tag/1.1.0
Thanks. By the way, any plan for emoji support?
Depends on how this goes: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2913 The conversion is done using another program
Just like a pdf book
A simple script to merge all pages into one pdf after all subpages are exported.
import sys
from PyPDF2 import PdfFileMerger
import os
import importlib
importlib.reload(sys)
def GetFileList(dir, fileList):
newDir = dir
if os.path.isfile(dir):
fileList.append(dir.encode('gbk').decode('gbk'))
elif os.path.isdir(dir):
#print(os.listdir(dir))
for s in os.listdir(dir):
newDir=os.path.join(dir,s)
#print(newDir)
GetFileList(newDir, fileList)
return fileList
def main(dir):
list_file = []
GetFileList(dir, list_file)
merger = PdfFileMerger()
for i in reversed(range(len(list_file))):
print(list_file[i])
pdf_input = open(list_file[i],'rb')
merger.append(pdf_input)
outfile_path = dir+'/output.pdf' #output pdf file name
pdf_out = open(outfile_path, 'wb')
merger.write(pdf_out)
if __name__ == "__main__":
documents_dir = 'C:/Users/xxx/Desktop/notion tool/pdfs' #input your pdfs path, without '/' in the end, like: 'C:/Users/xxxx/Desktop/notion tool/pdfs'
main(documents_dir)
Used https://github.com/mstamy2/PyPDF2 by comment /PyPDF2/pdf.py , line 1512,1513 to aviod the error " PyPDF2.utils.PdfReadError: Unexpected destination '/__WKANCHOR_2' "
Just like a pdf book