Android Guides | Samples

Android.Graphics.Pdf.PdfRenderer Class

Print preview and print output

  • Respect the property whether the document would like to be scaled for printing as per PdfRenderer.ShouldScaleForPrinting.
  • When scaling a document for printing the aspect ratio should be preserved.
  • Do not inset the content with any margins from the PrintAttributes as the application is responsible to render it such that the margins are respected.
  • If document page size is greater than the printed media size the content should be anchored to the upper left corner of the page for left-to-right locales and top right corner for right-to-left locales.

See Also: PdfRenderer

Syntax

[Android.Runtime.Register("android/graphics/pdf/PdfRenderer", DoNotGenerateAcw=true)]
public sealed class PdfRenderer : Object

Remarks

Print preview and print output

  • Respect the property whether the document would like to be scaled for printing as per PdfRenderer.ShouldScaleForPrinting.
  • When scaling a document for printing the aspect ratio should be preserved.
  • Do not inset the content with any margins from the PrintAttributes as the application is responsible to render it such that the margins are respected.
  • If document page size is greater than the printed media size the content should be anchored to the upper left corner of the page for left-to-right locales and top right corner for right-to-left locales.

This class enables rendering a PDF document. This class is not thread safe.

If you want to render a PDF, you create a renderer and for every page you want to render, you open the page, render it, and close the page. After you are done with rendering, you close the renderer. After the renderer is closed it should not be used anymore. Note that the pages are rendered one by one, i.e. you can have only a single page opened at any given time.

A typical use of the APIs to render a PDF looks like this:

If you are using this class to rasterize a PDF for printing or show a print preview, it is recommended that you respect the following contract in order to provide a consistent user experience when seeing a preview and printing, i.e. the user sees a preview that is the same as the printout.

See Also

[Android Documentation]

Requirements

Namespace: Android.Graphics.Pdf
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Graphics.Pdf.PdfRenderer are listed below.

See Also: Object

Public Constructors

Creates a new instance.

Public Properties

[read-only]
PageCountInt32. Gets the number of pages in the document.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Close()
Closes this renderer.
OpenPage(Int32) : PdfRenderer+Page
Opens a page for rendering.
ShouldScaleForPrinting() : Boolean
Gets whether the document prefers to be scaled for printing.