当前位置: 首页>>代码示例>>Java>>正文


Java PrintHelper类代码示例

本文整理汇总了Java中android.support.v4.print.PrintHelper的典型用法代码示例。如果您正苦于以下问题:Java PrintHelper类的具体用法?Java PrintHelper怎么用?Java PrintHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PrintHelper类属于android.support.v4.print包,在下文中一共展示了PrintHelper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printPhoto

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
public void printPhoto() {
    if (!(albumItem instanceof Photo)) {
        Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();
        return;
    }

    PrintHelper photoPrinter = new PrintHelper(this);
    photoPrinter.setScaleMode(PrintHelper.SCALE_MODE_FIT);
    try {
        photoPrinter.printBitmap(albumItem.getPath(),
                albumItem.getUri(this));
    } catch (FileNotFoundException e) {
        Toast.makeText(this, "Error (FileNotFoundException)", Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:17,代码来源:ItemActivity.java

示例2: Click

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
@OnClick({R.id.printHelper, R.id.genPdf})
public void Click(View view) {
    switch (view.getId()) {
        case R.id.printHelper:
            PrintHelper mPrintHelper = new PrintHelper(this);
            mPrintHelper.setColorMode(PrintHelper.SCALE_MODE_FIT);
            Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.a5);
            mPrintHelper.printBitmap("print-bitmap", mBitmap);
            break;
        case R.id.genPdf:
            genPdfFile();
            break;
        default:
            break;
    }
}
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:17,代码来源:PdfActivity.java

示例3: printImage

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
public void printImage()
{
   if (PrintHelper.systemSupportsPrint())
   {
      // use Android Support Library's PrintHelper to print image
      PrintHelper printHelper = new PrintHelper(getContext());
      
      // fit image in page bounds and print the image
      printHelper.setScaleMode(PrintHelper.SCALE_MODE_FIT);
      printHelper.printBitmap("Doodlz Image", bitmap); 
   }
   else
   {
      // display message indicating that system does not allow printing
      Toast message = Toast.makeText(getContext(), 
         R.string.message_error_printing, Toast.LENGTH_SHORT);
      message.setGravity(Gravity.CENTER, message.getXOffset() / 2, 
         message.getYOffset() / 2);
      message.show(); 
   }
}
 
开发者ID:dwa012,项目名称:CSCI4669-Fall15-Android,代码行数:22,代码来源:DoodleView.java

示例4: type

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
public static SubjectFactory<PrintHelperSubject, PrintHelper> type() {
  return new SubjectFactory<PrintHelperSubject, PrintHelper>() {
    @Override
    public PrintHelperSubject getSubject(FailureStrategy fs, PrintHelper that) {
      return new PrintHelperSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:PrintHelperSubject.java

示例5: print

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
private void print() {
    // Get the print manager.
    PrintHelper printHelper = new PrintHelper(this);

    // Set the desired scale mode.
    printHelper.setScaleMode(PrintHelper.SCALE_MODE_FIT);

    // Get the bitmap for the ImageView's drawable.
    Bitmap bitmap = ((BitmapDrawable) mImageView.getDrawable()).getBitmap();

    // Print the bitmap.
    printHelper.printBitmap("Print Bitmap", bitmap);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:14,代码来源:PrintBitmap.java

示例6: printImage

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
private void printImage(String fileName, Bitmap bitmap) {
    if (PrintHelper.systemSupportsPrint()) {
        PrintHelper printHelper = new PrintHelper(this);
        printHelper.setColorMode(PrintHelper.COLOR_MODE_COLOR);
        printHelper.setScaleMode(PrintHelper.SCALE_MODE_FIT);
        printHelper.printBitmap(fileName, bitmap);
    } else {
        Toast.makeText(this, "この端末では印刷をサポートしていません", Toast.LENGTH_SHORT)
                .show();
    }
}
 
开发者ID:sys1yagi,项目名称:PrintingFrameworkSample,代码行数:12,代码来源:ImagePrintActivity.java

示例7: PrintHelperSubject

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
protected PrintHelperSubject(FailureStrategy failureStrategy, PrintHelper subject) {
  super(failureStrategy, subject);
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:4,代码来源:PrintHelperSubject.java

示例8: doPhotoPrint

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
private void doPhotoPrint(Bitmap bitmap) {
    PrintHelper photoPrinter = new PrintHelper(this);
    photoPrinter.setScaleMode(PrintHelper.SCALE_MODE_FIT);
    photoPrinter.printBitmap("Design print", bitmap);
}
 
开发者ID:ibm-messaging,项目名称:mqtt-smartboard,代码行数:6,代码来源:MyActivity.java

示例9: printWithAdapter

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
private void printWithAdapter(String jobName, PrintDocumentAdapter adapter) {
    if (PrintHelper.systemSupportsPrint()) {
        PrintManager printManager = 
          (PrintManager) getSystemService(Context.PRINT_SERVICE);
        printManager.print(jobName, adapter, null);
    } else {
        Toast.makeText(this,
          "この端末では印刷をサポートしていません",
          Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:sys1yagi,项目名称:PrintingFrameworkSample,代码行数:12,代码来源:CustomPrintActivity.java

示例10: printHtml

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
private void printHtml(String fileName, WebView webView) {
    if (PrintHelper.systemSupportsPrint()) {
        PrintDocumentAdapter adapter = webView.createPrintDocumentAdapter();
        PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
        printManager.print(fileName, adapter, null);
    } else {
        Toast.makeText(this, "この端末では印刷をサポートしていません", Toast.LENGTH_SHORT)
                .show();
    }
}
 
开发者ID:sys1yagi,项目名称:PrintingFrameworkSample,代码行数:11,代码来源:HtmlPrintActivity.java

示例11: PrintHelperAssert

import android.support.v4.print.PrintHelper; //导入依赖的package包/类
public PrintHelperAssert(PrintHelper actual) {
  super(actual, PrintHelperAssert.class);
}
 
开发者ID:square,项目名称:assertj-android,代码行数:4,代码来源:PrintHelperAssert.java


注:本文中的android.support.v4.print.PrintHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。