Coder Social home page Coder Social logo

abstract4pdf's Introduction

Abstract4PDF

  1. Take "screenshots" for the elements of webpage.
  2. Reformat by [Document Definitions]1 and export to PDF.

How to use

<!--[if lt IE 9]>

<script src="https://cdn.bootcss.com/babel-polyfill/7.0.0-beta.46/polyfill.min.js"></script>
<script src="./flashcanvas/flashcanvas.js"></script>

<script type="text/javascript" src="./canvg/rgbcolor.js"></script> 
<script src="https://cdn.bootcss.com/stackblur-canvas/1.4.1/stackblur.min.js"></script>
<script src="https://cdn.bootcss.com/canvg/1.5/canvg.min.js"></script>

<![endif]-->

<script src="./pdfmake.min.js"></script>
<!--
vfs_fonts.js with CJK fonts is very huge. So use canvas.
script src="./vfs_fonts.js"></script
-->
<script src="./html2canvas.js"></script>
<script src="./abstract4pdf.js"></script>
<body>
    <h3 id="head">
        Abstract4PDF <small>v0.1.0</small>
    </h3>
</body>

Use the following code, it rendering element #head and create file Untitled.pdf.

let docDefinition = {
    filename: "Untitled.pdf",
    content: [
       {
           // Title
           image: 'head',
           style: 'section'
       },
       {
           // Placeholder
           image: 'placeholder',
           style: 'section'
       }
   ]
};

let builder = new Abstract4PDF(docDefinition);
builder.build(['head']);
builder.download();

Thanks

Footnotes

  1. pdfmake โ†ฉ

abstract4pdf's People

Contributors

gitaiqaq avatar

Watchers

 avatar  avatar  avatar

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.