Using pdfkit to convert embedded images - html

I am trying to convert HTML files into PDFs, using pdfkit on python. I use the very simple code below:
import pdfkit
pdfkit.from_file('in.html', 'out.pdf')
The problem is that these HTMLs have charts (like Highcharts or Plotly) embedded into them and they do not show on out.pdf. I know from this GitHub post which describes the same issue that this has been a long standing problem with wkhtmltopdf, which has still not been fully resolved. Yet I was wondering if there was a workaround?
Thank you!
Kind regards

Related

How to Convert Figma API response to FIGMA Design Code?

I am using Figma API to get a document. The response is in JSON Object. I want to convert that JSON Object, so that I can copy it into Figma UI or Convert the response to a compatible import file for Figma UI. Any Ideas, How to do that ? I know it is possible because https://www.landingfolio.com/library/all/figma landing folio already does that, I inspected the website a bit but couldn't find how they did it ! So any ideas ?
I tried looking at the docs of the Figma API I couldn't find any help there ! I tried to inspect the website landingFolio, because they do it. It seems like they do the conversion at the backend and only send you the component for Figma UI.
Did you check this plugin on Figma Community? Try this plugin Run Plugin API

Export/Download Clickfunnels as HTML (including all assets)

I'm trying to download a a funnel in Clickfunnels as a whole assets. I know the typical step that Clickfunnel have in exporting HTML is through the Publishing option->Export as HTML
. But it don't include the whole code and assets used in front-end. Anybody have an idea to download the funnel including the images,fonts,css, html used? Thanks
As far as I know you can not download/export everything as HTML.

Python jupyter notebook after converting to html , numbering of markdown disappeared

I used Table of Contents(2) of Nbextensions to create Table of Contents. And the titles were created using markdown.
Every thing is working fine. I mean , it looks pretty good in notebook modus.
But after I had converted the ipynb file to html file , then the number of each title dispeared . I used menu: File->Download as -> HTML to do this.
I tried to use another option "File->Download as ->HTML with toc" to convert to html. Although it generated desired numbering , this is still not what I want, because it will generate not only an html file but also multiple images file if there are some plots in the notebook.
Does anyone have a good idea?
I just need a SINGLE html file with everything embedded .
The numbering of the Nbextensions will be present if you'll download the notebook to PDF (after installing the relevant packages).
Regarding the HTML version, I didn't find an answer yet and will be happy for help either.
Notebook uses different formatting for the content. Exporting option only provide you to save your code. So, that you can send it to others.
Better save the data in the python notebook form itself to maintain formatting. Even exporting you to PDF won't provide you true formatting as the notebook does. But it will be better than HTML.
But if you still want the HTML format, you can format it manually as a webpage. May the formatting get improved in next version of nbconvert.

html2pdf generates corrupted parts in the downloaded file

I used html2pdf in my code to enable converting html files to pdf ones then downloading them.
In my html file I have some statistic graphics coded using amChart.
The problem is that I have got a perfect file but with corrupted parts. The parts that contains the amChart graphics.Here is the graph in the html page:
and here is what I have got in the downloaded pdf file
I used this code to enable the download (with angular I just installed the necessary dependecies using bower).
Hello Someone
<div pdf-save-content="idOne" >
Hello Someone
</div>
Can someone please help me fix this problem?
I know that amchart provides a library to download the graphs with different forms (csv, png,pdf,..) it's not what need, I need to download the whole page.
it's not either a width problem.
to solve this problem I used this amCharts demo. It was better to use pdfMake than html2pdf
chart["export"].toPDF(layout, function(data) {
this.download(data, "application/pdf", "amCharts.pdf");
});

Python Convert HTML Image to PNG

Given a saved HTML file with an image (an output from Bokeh), how can I save it as a PNG file with a DPI of 300?
I found some answers to similar questions, but they don't seem to work for me. I think I need someone to explain the whole process (importing the needed package, where it needs to be located if applicable, and how to call it).
I've tried this after pip installing webkit2png:
import os
os.system("webkit2png" "texas.html")
I've also tried:
import subprocess
subprocess.call("webkit2png", "texas.html")
Thanks in advance!
As of Bokeh 0.12.6, it is now possible to export PNG and SVG directly from
Python code.
Exporting PNGs looks like this
export_png(plot, filename="plot.png")
And exporting SVGs looks like this
plot.output_backend = "svg"
export_svgs(plot, filename="plot.svg")
There are some optional dependencies that need to be installed.
You can find more information in the Exporting Plots section of the User Guide.
Currently, plots are saved at their native resolution, but in 0.12.7 you will be able to set the size.
There's no such thing as an "HTML image." HTML enables one to incorporate image files of various types within an HTML document, which a Web browser knows how to display and process.
Run your Bokeh (?) code and use a commercial screen capture utility (I like SnagIt!, which is FREE). That gives you the capability of saving out the image to disk in a wide array of formats (JPEG, TIF, PNG, GIF, etc.).