How to obtain .pdf

Hi, it’s sice more than 4 year that I do not use the platform.
Now I need to rebuild a .pdf of the BIG work I’ve made years ago.
I have the repository with all my .md files, images files and script

I would re build a .pdf to show to my boss, to let him understand what I could do about documentation
(because my work could change and I would works on documentation)
Canyou please help me to remember how can I recompile and obtain .pdf ?

TIA

Renato

I use Pandoc in one of my projects to generate both PDF and HTML from Markdown. :slightly_smiling_face:

The relevant Makefile snippet:

ok. So I cannot obtain (.pdf and HTML) from inside GIT. I need panda to create it?

Can you suggest me some link to watch what I have to do?
I’ve forget absolutely all

Check the Pandoc manual: Pandoc - Pandoc User’s Guide

There are a lot of options depending on what exactly you want (styles, metadata, …), but in general the command will be similar to:

pandoc -f markdown -o file.pdf file1.md file2.md

Ok, thank you for the information.
I0ve installed Pandoc on my Mac osx
Now, I need to use (your example text) Pandoc to transform my files on a .pdf (with all the link inside the .md files)

Do I have to download the folder from ReadTheDoc?
Or I can use Pandoc with URL?

TIA

firma.jpg

I’m not sure what you mean, what would ReadTheDoc have to do with this? You mentioned having a repository with your markdown files, just use Pandoc on those. And maybe add a script or Makefile to build the PDF docs to the repository for future use. :slightly_smiling_face:

yes (as I told you before, is more that 5 years…)
On ReadTheDoc was the place where I start to create the Git repo, but maybe it is not the place where do I have to reach the objective.

With all the file (.md file) that I have on the repo, I need to build a .pdf file.
On the repo, I have a .md files where inside I recall an images, so all this (text, images) create a .pdf

Maybe I need some help from ReadTheDoc?

TIA

Renato

You need to clone the Git repository to your machine. Assuming all the text and images are in the repository that should give you all you need.

Ok, I’ve downloaded the repo on my pc (and installed Pandoc)
Now I have the entire tree )with images, .md files , .json…how can I create I single .pdf file?

Ok, I was able to compile. but I received an error (so I do not obtain my .pdf The error is the following:

ome/docs/checkouts/readthedocs.org/user_builds/manvbg/envs/latest/bin/python -m mkdocs build --clean --site-dir _build/html --config-file mkdocs.yml ERROR - Config value: ‘site_dir’. Error: The ‘site_dir’ should not be within the ‘docs_dir’ as this leads to the build directory being copied into itself and duplicate nested files in the ‘site_dir’.(site_dir: ‘/home/docs/checkouts/readthedocs.org/user_builds/manvbg/checkouts/latest/_build/html’, docs_dir: ‘/home/docs/checkouts/readthedocs.org/user_builds/manvbg/checkouts/latest’)

Aborted with 1 Configuration Errors! Ora del comando: 0s Ritorna: 1

I’ve understand that is an error of file configuration. But how can I correct it?

TIA

firma.jpg

That is an mkdocs error, not a Pandoc one. Mkdocs is for building HTML, check their documentation if you want to fix the HTML build. For PDF, check the Pandoc User Guide I linked above.

I am creating a pdf from a set of md files in my project as follows.

  1. Using a Python script, I glue a set of md files in the desired order into a single md file. At the same stage, additional data is substituted into the contents of the md file (current version numbers, etc.).

  2. Using grip, I translate the md file into html.

from grip import export

export('temp.md', out_filename='temp.html', title="User Guide")
text = open('temp.html').read().replace('/__/grip/static/', 'venv/Lib/site-packages/grip/static/')  # fix css items path
with open('guide.html', 'wt') as output:
    output.write(text)
  1. Using wkhtmltopdf, I translate the html file into pdf.
wkhtmltopdf --enable-local-file-access guide.html UserGuide.pdf

All these steps are integrated into the makefile and call as

make pdf

Wonderful job!
Can you send me the html and .pdf?
Than you

firma.jpg

for example.

I’ve understand how and I can try to obtain that.
But, my prob is I need a console (or somethings similar) where I can out your script (Carefully modified).
I’m wondering where do I can start this console in GITHUB?

TIA

Renato

You can’t, that’s something you have to do locally. How to do that depends on which OS you are using.

You can run shell commands or scripts in GitHub Actions, but that’s more for automating the build once you have the right commands figured out.

I’ve a MAC osx 11.2.3
I’ve opened a console and copy/paste your script without changing the name of files (I’ve done this just to check if the OS has the command I ask to execute)
It seems that my prob are not the command I ask to execute, but somethings else. This is the output
can you help me?

renatopontefice@iMac-di-Renato ~ % from grip import export

export(‘temp.md’, out_filename=‘temp.html’, title=“User Guide”)
text = open(‘temp.html’).read().replace(’/__/grip/static/’, ‘venv/Lib/site-packages/grip/static/’) # fix css items path
with open(‘guide.html’, ‘wt’) as output:
output.write(text)
from: can’t read /var/mail/grip
zsh: number expected
renatopontefice@iMac-di-Renato ~ %

What you have there is a Unix shell, specifically zsh as the error message says. The script @vb64 suggested is Python, as mentioned in that post. So if you want to use it you have to write it to a file and run it with the Python interpreter.

Though I still recommend using Pandoc, which can do Markdown to PDF in one step. :slightly_smiling_face:

AirPower-luna
please tell me how I can create my PDF.
I think it’s a real shame than I have all the .md file (wrote form myself, and images and glossary…) and I cannot use them because of my mind…

Renato

I’ve already posted an example command (for your console) above:

Just replace file1.md file2.md with a list of your files in the order they should have in the PDF. And if you want more options check the documentation linked there.

Finally I’ve my PDF (I’had to install some TEX suite to let pandoc transform .md in .pdf)
but now I have a .pdf without images (I think because of the path of images)

Open the .md I can see that images are referenced in this way:

![](/assets/img_set_creazione.jpg)

What does

> ![]

mean?

of course is a problem of path. Can I solve that problem?

Thank you

Renato