Comments (6)
Is it possible to pass in custom HTML as a parameter instead of pointing to a URL?
I want to generate a pdf from HTML templates (using Jinja/Nunjucks)
Do you want to use local file path?
from doctron.
Not local path. Instead of passing in URL, I wanted to pass in plain HTML directly?
from doctron.
Not local path. Instead of passing in URL, I wanted to pass in plain HTML directly?
Could you give me an example?
from doctron.
My use case is as follows:
Let's say I have an HTML template called sample.html
<html>
<div class="container">
<h1 class="title">
{{ title }}
</h1>
<h2 class="subtitle">
{{ subtitle }}
</h2>
</div>
</html>
I want to use a templating engine like Jinja to pass in data to the template and generate the HTML
(render_template('sample.html', title = "Foo", subtitle="bar")
) to get
<html>
<div class="container">
<h1 class="title">
Foo
</h1>
<h2 class="subtitle">
Bar
</h2>
</div>
</html>
Using this generated HTML, I want to create an image or pdf.
Is there a way to do this using Docton?
from doctron.
My use case is as follows:
Let's say I have an HTML template called
sample.html
<html> <div class="container"> <h1 class="title"> {{ title }} </h1> <h2 class="subtitle"> {{ subtitle }} </h2> </div> </html>
I want to use a templating engine like Jinja to pass in data to the template and generate the HTML
(render_template('sample.html', title = "Foo", subtitle="bar")
) to get<html> <div class="container"> <h1 class="title"> Foo </h1> <h2 class="subtitle"> Bar </h2> </div> </html>
Using this generated HTML, I want to create an image or pdf.
Is there a way to do this using Docton?
You may upload your generated html to your http server where the uri can reach by Doctron.
from doctron.
Doing this is tricky because Docton needs to fetch the HTML via a GET request. But passing in large amounts of data to an HTML template through a GET request is not easy/recommended.
It would be really useful to have an enhancement to pass in an HTML string directly. But thanks for your help!
from doctron.
Related Issues (20)
- 接口可以传递HTML文本内容不 HOT 4
- Render Icon HOT 1
- 图片超过3M时转换 HOT 2
- [read config ReadInConfig] err HOT 4
- Error after generation HOT 1
- code:30000000 google-chrome\": executable file not found in %PATH% HOT 1
- 生成的pdf中,汉字全部不显示 HOT 3
- the master branch is not work HOT 3
- 页脚的url怎么去掉 HOT 1
- 自定义页眉页脚 HOT 2
- Is it possible to use custom width and auto height?It's the most possible case. HOT 2
- I found some pictures that couldn't be displayed HOT 2
- [bug] html2image for long page fail HOT 4
- 能否增加一个自适应html的高度 HOT 1
- linux环境html2pdf字体或样式有变化 HOT 3
- exec: "google-chrome": executable file not found in $PATH HOT 1
- HeaderTemplate和FooterTemplate 如何生效?
- 并发请求转换时出现错误 HOT 4
- 针对包含latex公式的html转换错误 HOT 1
- arm架构html转pdf报错 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctron.