⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hello.py

📁 windows下PDF文档的开发包
💻 PY
字号:
#!/usr/bin/python
# $Id: hello.py,v 1.11.2.2 2003/12/17 15:38:01 tm Exp $
#
# PDFlib client: hello example in Python
#

from sys import *
from pdflib_py import *

# create a new PDFlib object
p = PDF_new()

# open new PDF file
if PDF_open_file(p, "hello.pdf") == -1:
    print "Error: " + PDF_get_errmsg(p) + "\n"
    exit(2)

# This line is required to avoid problems on Japanese systems
PDF_set_parameter(p, "hypertextencoding", "winansi")

PDF_set_info(p, "Author", "Thomas Merz")
PDF_set_info(p, "Creator", "hello.py")
PDF_set_info(p, "Title", "Hello world (Python)")

PDF_begin_page(p, 595, 842)		# start a new page

font = PDF_load_font(p, "Helvetica-Bold", "winansi", "")

PDF_setfont(p, font, 24)
PDF_set_text_pos(p, 50, 700)
PDF_show(p, "Hello world!")
PDF_continue_text(p, "(says Python)")
PDF_end_page(p)				# close page

PDF_close(p)				# close PDF document

PDF_delete(p)				# delete the PDFlib object

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -