Thursday, September 11, 2014

Android L PDF Render for Print on Nexus 7

Android L, previously known as Android 5, is a major departure for Android OS, with a completely redesigned interface, more fluid animations, Bluetooth Low Energy broadcasting, NFC enhancement, a renewed focus on improving battery life, and compatibility with 64-bit processors, will be released in this Fall.

Regarding to the enhancement in Printing Framework, a native PDF renderer is added to convert PDF to a bitmap, which can be used for print preview, according to Chet Haase.

A typical use of the APIs to render a PDF looks like this:
 // create a new renderer
 PdfRenderer renderer = new PdfRenderer(getSeekableFileDescriptor());

 // let us just render all pages
 final int pageCount = renderer.getPageCount();
 for (int i = 0; i < pageCount; i++) {
     Page page = renderer.openPage(i);

     // say we render for showing on the screen
     page.render(mBitmap, null, null, Page.RENDER_MODE_FOR_DISPLAY);

     // do stuff with the bitmap

     // close the page
     page.close();
 }

 // close the renderer
 renderer.close();
 
The Android L preview image can be downloaded from the Android developer website:

DeviceDownloadChecksum
Nexus 5 (GSM/LTE)
"hammerhead"
hammerhead-lpv79-preview-ac1d8a8e.tgzMD5: 5a6ae77217978cb7b958a240c2e80b57
SHA-1: ac1d8a8e4f4a1dca5864dc733caa940bffc28616
Nexus 7 (Wifi)
"razor"
razor-lpv79-preview-d0ddf8ce.tgzMD5: b293a5d3a4e07beabebcc0be85ad68a2
SHA-1: d0ddf8ce733ba2a34279cdff8827fd604762c2342d

  1. Download the appropriate system image for your device below, then unzip it to a safe directory.
  2. Connect your device to your computer over USB.
  3. Start the device in fastboot mode with one of the following methods:
    • Using the adb tool: With the device powered on, execute:
      adb reboot bootloader
    • Using a key combo: Turn the device off, then turn it on and immediately hold down the relevant key combination for your device. For example, to put a Nexus 5 ("hammerhead") into fastboot mode, press and hold Volume Up + Volume Down + Power as the device begins booting up.
  4. If necessary, unlock the device's bootloader by running:
    fastboot oem unlock
    The target device will show you a confirmation screen. (This erases all data on the target device.)
  5. Open a terminal and navigate to the unzipped system image directory.
  6. Execute the flash-all script. This script installs the necessary bootloader, baseband firmware(s), and operating system.

No comments:

Followers

About Me

My photo
HD Multimedia Technology player