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. The model creates the filename as a slug appended with pdf creates a dict of the variables and calls def generate_or_serve_pdf( self, saving = False ): """ Return a link to the PDF of this CV, generating one only if necessary. """ self.filename = "%s.pdf" % self.slug pdfurl = os.path.join( settings.MEDIA_URL, "pdf", self.filename ) pdfpath = os.path.join( settings.MEDIA_ROOT, "pdf", self.filename ) if saving == True or not os.path.exists( pdfpath ): super( CVMask, self ).save() url = """%s/%s/""" % ( settings.CVBASE, self.slug ) pdfgen( url, pdfpath ) #return pdfurl else: return pdfurl pdfgen is def pdfgen( url, outputfile = None, testing = False ): """ Generate a PDF file from the supplied URL and write it to outputfile when complete: >>> pdfgen("http://www.google.com", "testpdfgen.pdf", testing = True ) """ if os.path.exists( outputfile ): os.unlink( outputfile ) 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 ) worker.wait() os.rename( outputfile+"_tmp", outputfile ) 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. Using XHTML2PDF it all works fine but with some horrible inconstencies in the rendering and just want to try this to see if it is better but if the pdf isn;t generated in the first place I can't do that. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6fbbfd3f-f66b-4021-8c0e-200544660189%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.