If your console output shows other fonts that you don't want in there just add it to the statement. The console.log will show you these string fonts if you try to make a pdf. There are three ways to use PDFKit in the browser: Use Browserify. Since I removed it it threw an error trying to use it, the return prevent this. For more, see the demo folder and the PDFKit programming guide. def callpdfkit(self, htmlfile, uuiddirectoryname, uuidfilename): ''' Runs wkhtmltopdf to create a PDF file. It's probably the default font so that's why. In my case the generator still tried embedding Helvetica while making the pdf. mail EmailMultiAlternatives(Regarding Password Change,emailbody. I recommend to put a console.log(src) under there and then a conditional statement with a return, like this: def testcustomconfiguration(self): conf nfiguration() self. Now, in PDFFont() (~line 456) it checks for typeof scr = 'string'. Also make sure your server uses gzip compression, this helps a lot too.įirst look for STANDARD_FONTS (it's below PDFFont()) and remove its contents entirely leaving an empty object (STANDARD_FONTS = ) Of course if you still want to use one of the fonts listed there keep it in. The available options are: wkhtmltopdf - the location of the wkhtmltopdf binary. ![]() Let’s do another example, but this time, we’ll create a table using HTML. It takes the configuration options as initial paramaters. ![]() You simply need to pass the HTML as a string or store it in a file that can be passed to pdfkit. ![]() Minifying this can reduce it to about 300KB but I haven't tested that really (there are other topics about that). omfile ('samplehtmlfile.html', outputpath 'newfile2.pdf', configuration config) You can also create PDF files with more complex HTML / CSS, as well. I just did this and it reduced the file to 635KB. You can easily remove the fonts yourself if you like. The following are 4 code examples of nfiguration().
0 Comments
Leave a Reply. |