I solved it this way:
according to
https://www.quora.com/How-to-create-a-PDF-out-of-Sphinx-documentation-tool
I did
pip install rst2pdf
Then added this task to makefile
.PHONY: pdf
pdf:
sphinx-build -b pdf source build/html
@echo "pdf finished; the PDF files are in $(BUILDDIR)."
On conf.py
I added 'rst2pdf.pdfbuilder' to extensions
and I programatically created pdf_documents
# collect all rst files
matches = []
for root, dirnames, filenames in os.walk(os.getcwd()):
for filename in fnmatch.filter(filenames, '*.rst'):
matches.append(os.path.join(root, filename))
# for python 3.5+ we could just use glob
# import glob
# matches = glob.glob(path, recursive=True)
# initially add the master document, this will generate pdf for the full docs
pdf_documents = [('index', u'index', u'Kamanja Documentation', u'Meg
McRoberts'),]
# 1 - master document
# 2 - name of the generated pdf
# 3 rst2pdf doc - title of the pdf
# 4 author name in the pdf
# iterate over rst files and fill pdf_documents, this will generate pdf for
each rst file
path = "**/*.rst"
for fname in matches:
fn = fname.split(os.getcwd() + '/')[1]
fn = fn.split('.')[0]
pdf_documents.insert(0,(fn,fn, fn, u'Meg McRoberts'));
That solved my case,
I don't think this is the optimal solution, but it saved me from dealing
with latex which seems little complicated to me as a beginner in this area
of programming.
On Thursday, 16 February 2017 02:05:18 UTC+3, Aladdin Mhaimeed wrote:
>
> I could use sphinx-build to export all docs to one pdf,
> but my target is to export each rst file to a separate pdf file in a
> similar tree like rst tree,
> any ideas?
> thanks
>
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.