Giter Site home page Giter Site logo

blahblehblah / capacitor-plugin-printer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bariscanyesil/capacitor-plugin-printer

0.0 0.0 0.0 298 KB

Capacitor plugin for printing HTML format value iOS/Android apps.

JavaScript 5.36% Ruby 11.05% Objective-C 7.45% Java 38.92% TypeScript 11.98% Swift 25.24%

capacitor-plugin-printer's Introduction

capacitor-plugin-printer

Capacitor plugin for printing HTML format value iOS/Android apps.

This plugin supports Capacitor v5.x

Printer.print({ content: '<b>Lorem ipsum...</b>'})

screenshoots

Supported Platforms

  • Android 5.1+
  • iOS 13+

Supported Contents

  • HTML (can use CSS inline styling)
  • Text
  • Image(as HTML)

Install

npm install @bcyesil/capacitor-plugin-printer
npx cap sync

Usage

import { Printer } from '@bcyesil/capacitor-plugin-printer';

.
.
.

Printer.print({ content: 'Lorem ipsum...', name: 'lorem-filename', orientation: 'landscape' })

Examples

Text:

 Printer.print({ content: 'Lorem ipsum...'})

HTML:

 Printer.print({ content: '<h1>Lorem</h1>'})

Suggestion for multiple lines:

    let contentTest: string = "";

    contentTest += '<li style="color:green">Tea</li>'
    contentTest += '<li style="font-size:50px">Coffee</li>'
    contentTest += '<img src="https://picsum.photos/200">'

    Printer.print({ content: contentTest })

Images with HTML:

 Printer.print({ content: '<img src="base64/url/path">'})

with inline CSS:

 Printer.print({ content: '<b style="color:red">Lorem ipsum</b>'})

API

print(...)

print(printOptions: PrintOptions) => Promise<void>
Param Type
printOptions PrintOptions

Interfaces

PrintOptions

Prop Type Description Default Since
content string HTML content for print. 0.0.1
name string Name of the print of the document. iOS=YourAppName/Android=Document+CurrentTimestamp 0.0.1
orientation string Orientation of the printing page. "portrait" or "landscape" "portrait" 0.0.1

capacitor-plugin-printer's People

Contributors

bariscanyesil avatar blahblehblah 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.