Author: Md. Abid Hasan

  • Print in Capacitor using CapacitorJS Printer

    Print in Capacitor using CapacitorJS Printer

    CapacitorJS Printer is a javascript based opensource npm project to print html content. In this tutorial we will use a capacitorjs plugin developed by Softtl to print a HTML document from android mobile device. The name of the plugin is capacitrojs-printer.

    CapacitorJS is an Open Source Framework used for building Cross-Platform native mobile applications using web technologies such as HTML, CSS, and JavaScript which are capable of running on Android and macOS operating systems. It combines the Chromium engine and NodeJS into a Single Runtime.

    In certain mobile applications, developers would like to provide a feature wherein the user can download or print the contents from within the application. For example, in a banking application, the user would like to print his/her account statement being displayed on the screen. Capacitorjs, in addition to saving the contents as a PDF file, also provides a way by which we can directly print the contents from your android mobile device. You will have to connect a printer with your mobile by Bluetooth, And capacitrojs-printer plugin will do all the other work to print html content.

    Step 1: Navigate to the capacitor project Directory, and run the following command. It will install the capacitorjs-printer plugin on your nodejs project:

    JavaScript
    npm install capacitorjs-printer
    npx cap sync

    Step 2: Use the printHtml code where you want to print a html content. Following example show you how to call printHtml function using capacitrojs-printer on vuejs.

    JavaScript
    // Import capacitorjs-printer on your project's .vue file
    import { CapacitorjsPrinter } from 'capacitorjs-printer';
    
    // Call the Print function to print a html content
    await CapacitorjsPrinter.printHtml({ "value": htmlContent });
    

    Step 3: Build your android app using android studio or command line and test it on your android device or emulator.

  • How to install wordpress

    How to install wordpress

    Do you thinking about making a website yourself? WordPress is the solution for you. It’s most popular cms in the world right now. You can easily build your website using it. This tutorial will help you to install wordpress yourself.

    Step 1: Download wordpress:

    Download wordpress zip package from http://wordpress.org/download/ and upload the zip file to your hosting account. Extract the zip file to the directory where you would like to install wordpress. So extracted files will look like the image bellow:

    Step 2: Setup database

    WordPress installation process requires database. To create a database, go to cpanel and click MySQL® Database Wizard > Create a Database > Create Database Users > Add user to the database.  Note down database name, database username and password.

    Step 3: Install wordpress

    You are ready to install wordpress now. Go to the url on your browser where you extracted all wordpress files.

    For example: http://www.example.com/

    Now you will see the wordpress installation process on your browseer like the image bellow.

    Select language then press continue. Next screen will ask you for database information. Fill the form by database information you noted down.

    Next steps will ask you to choose your website title, user name and password. Your website is ready now! Go to the url where you installed wordpress. You will able to see your website’s home page with a default wordpress theme.