GithubHelp home page GithubHelp logo

Custom HTML about doctron HOT 6 CLOSED

lampnick avatar lampnick commented on May 21, 2024
Custom HTML

from doctron.

Comments (6)

lampnick avatar lampnick commented on May 21, 2024

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.

noelmathewisaac avatar noelmathewisaac commented on May 21, 2024

Not local path. Instead of passing in URL, I wanted to pass in plain HTML directly?

from doctron.

lampnick avatar lampnick commented on May 21, 2024

Not local path. Instead of passing in URL, I wanted to pass in plain HTML directly?

Could you give me an example?

from doctron.

noelmathewisaac avatar noelmathewisaac commented on May 21, 2024

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.

lampnick avatar lampnick commented on May 21, 2024

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.

noelmathewisaac avatar noelmathewisaac commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.