Git Product home page Git Product logo

db_project's Introduction

DB_Project

โปรเจ็คสำหรับวิชา Database Systems

Requirements

pyhon and the following modules:

  • fpdf
  • django
  • unicode font

วิธีติดตั้ง FPDF สำหรับ python2.7 windows8.1

  • โหลดตัวติดตั้งจาก Download แล้วทำการแตกไฟล์
  • เปิดหน้าต่าง command line แล้วเข้าไปยังไดเรกทอรีที่เพิ่งแตกไฟล์ออกมาแล้วพิมพ์คำสั่ง python setup.py install
  • Download unicode font ได้เป็นไฟล์ zip ออกมา ทำการแตกไฟล์จะได้โฟล์เดอร์ font ออกมา
  • ย้ายไฟล์เดอร์ font ไปเก็บยัง C:\Python27\Lib\site-packages\fpdf
  • ทดสอบโค้ด

Example

	#!/usr/bin/env python
	# -*- coding: utf-8 -*-
	from fpdf import FPDF

	pdf = FPDF('P', 'mm', 'A4')
	pdf.add_page()

	pdf.add_font('Kinnari', '', 'Kinnari.ttf', uni=True)
	pdf.set_font('Kinnari', '', 12) # 12 is font size

	pdf.cell(0, 10, u'สวัสดี')
	pdf.ln(10) # new line
	pdf.cell(0, 10, u'ชาวโลก')
	pdf.line(8, 20, 30, 20) # draw line(x1, y1, x2, y2)

	pdf.output('exam.pdf') # generate pdf file
  • ส่วน #-- coding: utf-8 -- ทำให้เราเขียนภาษาไทยใน code python ได้และให้เราเปลี่ยนค่า file encoding เป็น UTF-8 ด้วย

  • หลังจาก run สำเร็จแล้วจะได้ไฟล์ชื่อ exam.pdf ออกมา สามารถหาข้อมูลเกี่ยวกับ fpdf เพิ่มเติมได้ที่ https://code.google.com/p/pyfpdf/

db_project's People

Contributors

tachagon avatar wittawin avatar phongyanon avatar book4212 avatar premmika avatar krittineddy avatar

Watchers

James Cloos avatar  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.