python之打印机

AGG(Anti-Grain Geometry)Anti-Grain Geometry (AGG) is an Open Source, free of charge graphic library, written in industrially standard C++. The terms and conditions of use AGG are described on The License page. AGG doesn't depend on any graphic API or technology. Basically, you can think of AGG as of a rendering engine that produces pixel images in memory from some vectorial data. But of course, AGG can do much more than that. The ideas and the philosophy of AGG are:

Anti-Grain Geometry - About the Project  http://www.antigrain.com/about/index.html

QPrinter Class | Qt Print Support 5.10  http://doc.qt.io/qt-5/qprinter.html

from PyQt5 import QtWidgets, QtPrintSupport 
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem, QTabWidget, QFileDialog, QMessageBox
from PyQt5.QtGui import QTextDocument
from QtPrintSupport import  QPrinter
    @pyqtSlot()
    def on_pushButton_print_clicked(self):
        print("dsddsdsdsddssd")
        QPrinter(printer) 
        printer.setPageSize(0)
        printer.setOutputFormat(1)
        filepath = QFileDialog.getSaveFileName(this, tr("保存为..."), tr("D://成绩.pdf"), tr("PDF格式(*.pdf)"))
        printer.setOutputFileName(filepath)
        QTextDocument(textDocument)
        textDocument.setHtml(MakeDataToHtml())
        textDocument.print(printer)
        QMessageBox.about(this, tr("提示"), tr("保存成功"))

        print("dsddsdsdsddssd")
        printer=QPrinter() 
        printer.setPageSize(0)
        printer.setOutputFormat(1)
        filepath = QFileDialog.getSaveFileName(self, "保存为...", "D://成绩.pdf", "PDF格式(*.pdf)")
        print("ddddddddddddd", filepath)
        printer.setOutputFileName(str(filepath))
        textDocument=QTextDocument()
        textDocument.setHtml("dsdftrrrrrrergerr")
        textDocument.print(printer)
        QMessageBox.about(self, "提示", "保存成功")

from PyQt5 import QtWidgets, QtPrintSupport 


Python调用打印机参考例子 - 宁静的天空 - 博客园  https://www.cnblogs.com/ribavnu/p/4790262.html

Qt实现保存、浏览、预览、打印功能 - CSDN博客  https://blog.csdn.net/zbw1185/article/details/52184961

使用QPrinter生成pdf或用打印机打印数据 - 恒月美剑 - 博客园  https://www.cnblogs.com/jck34/p/4107885.html

QT表格打印_百度文库  https://wenku.baidu.com/view/82e1e7b669dc5022aaea0024.html点击打开链接

QT 打印的简单实现(转)_北极孤星_新浪博客  http://blog.sina.com.cn/s/blog_63578f1401013ars.html


python3+PyQt5 实现文档打印功能 - CSDN博客  https://blog.csdn.net/xiaoyangyang20/article/details/68941555



(转)用AGG实现高质量图形输出(一) - 3D入魔 - 博客园  http://www.cnblogs.com/mazhenyu/p/3911690.html

你可能感兴趣的:(python)