本文整理汇总了Python中PyQt4.QtGui.QPrinter.setFontEmbeddingEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QPrinter.setFontEmbeddingEnabled方法的具体用法?Python QPrinter.setFontEmbeddingEnabled怎么用?Python QPrinter.setFontEmbeddingEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPrinter
的用法示例。
在下文中一共展示了QPrinter.setFontEmbeddingEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Web_Page
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setFontEmbeddingEnabled [as 别名]
#.........这里部分代码省略.........
# =======================================================================
def FIND_ON_PAGE(self):
# -------------------------------------------------------------------
#print("FIND_ON_PAGE: "+self.UID );
try:
self.SEARCH_INPUT.setFocus();
self.SEARCH_INPUT_CTRL("show");
_value = unicode( str(self.SEARCH_INPUT.text()).strip() );
#findText (self, QString subString, FindFlags options = 0)
self.findText (_value, QWebPage.FindWrapsAroundDocument);
# QWebPage.HighlightAllOccurrences
except Exception as _err:
self.LOCAL_ERROR_LOG( str(_err) );
# -------------------------------------------------------------------
# =======================================================================
def PRINT( self ):
# -------------------------------------------------------------------
try:
pdf_name = self.GET_PAGE_TITLE()+"_"+str(self.PARENT.GET_TIME(True))+"_";
pdf_name = pdf_name.replace( " ", "-" ).replace( ":", "-" )+".pdf";
self.PRINTER = QPrinter( QPrinter.ScreenResolution );
self.PRINTER.setFontEmbeddingEnabled( False );
self.PRINTER.setFullPage( True );
#self.PRINTER.setPrinterName ("name of printer");
#self.PRINTER.setPrintProgram ( "print program");
self.PRINTER.setOutputFileName ( self.PARENT.DOWNLOAD_DIR+pdf_name );
# ------ >
#self.PRINTER.setOutputFormat( QPrinter.NativeFormat ); # <= IMAGE
self.PRINTER.setOutputFormat( QPrinter.PdfFormat ); # <= TEXT
#self.PRINTER.setOutputFormat( QPrinter.PostScriptFormat ); # ???
#QPrinter will print output using a method defined by the platform it is running on.
# This mode is the default when printing directly to a printer.
#QPrinter.NativeFormat [0]
#QPrinter will generate its output as a searchable PDF file. This mode is the default when printing to a file.
#QPrinter.PdfFormat [1]
#QPrinter will generate its output as in the PostScript format. (This feature was introduced in Qt 4.2.)
#QPrinter.PostScriptFormat [2]
self.mainFrame().print_( self.PRINTER );
self.LOCAL_INFO_LOG( "PDF: Saved ["+str(self.PARENT.DOWNLOAD_DIR+pdf_name)+"]" );
except Exception as _err:
self.LOCAL_ERROR_LOG( str(_err) );
# -------------------------------------------------------------------
# =======================================================================