0

My Sphinx input is six rst files and a bunch of PNGs and JPGs. Sphinx generates the correct HTML, but when I make pdf I get an output file that comes up blank in Adobe Reader (and comes up at over 5000%!) and does not display at all in Windows Explorer.

The problem goes away if I remove various input files or if I edit out what looks like entirely innocuous sections of the input, but I cannot get a handle on the specific cause. Any ideas on how to track this one down? Running Sphinx build with the -v option shows no errors.

I'm using the latest Sphinx (1.2.3) and the latest rst2pdf (0.93), with the default style. On Win7.

(added) This may help others with the same problem: I tried concatenating the rst files, then running rst2pdf on the concatenated file. That worked, though it gave me a bunch of warnings for bad section hierarchy and could not handle the Sphinx :ref: stuff. Could the bad section hierarchy thing (i.e. ==, --, ~~ in one file, ==, ~~, -- in another) be connected to the hopeless PDFs? Removing the conflict does not solve the problem, but that doesn't mean it's not a clue!

I could explore more if I could capture the output that Sphinx sends to rst2pdf.

timecc
  • 161
  • 1
  • 11
  • Can you post a link to one of your malformed PDF files? It sounds like something is going wrong when generating the file. If we can pin-point where this happens, it could be traced backwards in the Python sources. – Jongware Sep 14 '14 at 22:47
  • The default method for creating PDFs with Sphinx is via LaTeX. But you mention rst2pdf so I take it that you have configured Sphinx for this (see http://sphinx-doc.org/builders.html#sphinx.builders.latex.LaTeXBuilder). Right? – mzjn Sep 15 '14 at 10:32
  • @Jongware: It's a manual for a new product! If I linked to it I would need a new job. mzjn: yes, Sphinx/rst2pdf configured OK - it works with other input. More info added to the question. – timecc Sep 15 '14 at 23:00
  • 1
    If you want more than guesses, I think something reproducible is needed (see http://stackoverflow.com/help/mcve). – mzjn Sep 16 '14 at 07:33
  • Don't worry, I don't need real data. Just a PDF you created *exactly the same way* and of which you are sure exhibits the *exact same problem*. (See the problem here? If you don't know what causes it, how would you know we're investigating the actual problem? Still, anything is better than nothing at all.) – Jongware Sep 16 '14 at 19:15
  • @mzjn: I completely agree. That's why I didn't ask for a fix. I asked for hints as to how I can go about tracking down the issue. Usually these things can be sorted out by some sort of sequence of subdividing the input, but in this case the problem seems to go away if I remove any input lines! Jongware: Thanks. So far I have not managed to reproduce it with anything in my archive of Sphinx projects. I'll keep looking. If all else fails, I can submit the sources in a few weeks, when the product launches. – timecc Sep 17 '14 at 00:12
  • Did you originally build the project with the make target, or you did it manually? Also, can you post your log/output? **PS:** OK, I see about `make html`, but my request for output still stands. – wswld Sep 17 '14 at 11:57
  • Also, you're saying there is no file produced in the `_build` directory or there is, but it;s just blank? – wswld Sep 17 '14 at 11:59
  • I built with **make pdf** The pdf part of make.bat is this: if "%1" == "pdf" ( %SPHINXBUILD% -b pdf -v %ALLSPHINXOPTS% %BUILDDIR%/pdf echo. echo.Build finished. The PDF files are in %BUILDDIR%/pdf goto end ) – timecc Sep 18 '14 at 09:54
  • The comment above is tough to read. I could not find out how to insert a line break in a comment. Return doesn't seem to work, nor does 'space space return' – timecc Sep 18 '14 at 10:31
  • The output is not blank. It even appears to be a plausible length. But it does not display. Adobe Reader's first attempt to display brings up a blank page with the magnification showing at over 5000%. If I set the magnification to 100%, the screen shows a small white rectangle. Something in my input makes Sphinx and/or rst2pdf emit bad postscript/pdf. – timecc Sep 18 '14 at 11:07
  • @usr2564301 Hi, here is an issue with reproduction: https://github.com/sphinx-doc/sphinx/issues/4947. Could you please take a look at it? Thanks in advance! :) – T. Gawęda May 09 '18 at 14:03

1 Answers1

0

We had a similar problem: bad pdf output on project with a lot of chapters and images. We solved disabling the break page: in the conf.py, set the pdf_break_level value at 0.

  • That `pdf_break_level` didn't work for me. Rather look at https://stackoverflow.com/questions/5422997/sphinx-docs-remove-blank-pages-from-generated-pdfs – Csaba Toth Nov 25 '19 at 21:10