> Please excuse if this is the wrong forum and if a mod wants to move it please feel free, just please let me know where it went.
>
> I'm attempting to convert html to pdf on the fly with HTMLDOC.
>
> The fly in the ointment appears to be that the generated pdf is not viewable in that it opens Adobe Reader and gives a warning This PDF document might not be displayed correctly.
>
Sounds like an issue with the shell application you are using to generate it. Have you tried manually grabbing the generated file from the server (not through the web) and opening it with the same result?
> worker = subprocess.Popen( """htmldoc --webpage "%s" --linkstyle plain --footer ... --no-compression -t pdf14 > %s_tmp""" % ( url, outputfile ), shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT )
Have you tried running the command manually in the shell and then trying to open the PDF? That would eliminate Django as a culprit.
-James
> and then saves the result to a pdf file in /media/pdf
>
> but somewhere it would appear that the html is being lost and therefore not being converted or something.
>
I forgot to address this. When you say that the HTML is missing, do you mean that the CSS styling is missing? The HTML to PDF converters all have pretty limited support (if any) for CSS styling, which may be why your documents render incorrectly. That shouldn't cause an error with Adobe reader though.
Have you seen django-easy-pdf? It wraps in a bunch of the functionality that you are performing manually. Might be a good alternative.
http://django-easy-pdf.readthedocs.org/en/stable/
-James