natario1 / ViewPrinter

Live preview, edit and print functionality for View hierarchies. Supports PDF, PNG, JPEG.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

As the printSize changes, automatically fit page view to screen

EarlyWild opened this issue · comments

commented

Is it possible to automatically fit the page to the screen when changing printSize?

Using the template provided, when the printSize is change to NA_TABLOID for example, the view of the page is zoomed in. If you set the printSize in the XML layout as NA_TABLOID, then change the printSize to ISO_A5, the view of the page is zoomed out.

<com.otaliastudios.printer.DocumentView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:pageElevation="0.01in"
app:pageInsetTop="20pt"
app:pageInsetBottom="20pt"
app:pageInsetLeft="30pt"
app:pageInsetRight="30pt"
app:pageDividerWidth="0.1in"
app:columnsPerPage="1"
app:pageBackground="@color/white"
app:pagerType="horizontal"
app:printSize="ISO_A5">

<!-- Content here. -->

</com.otaliastudios.printer.DocumentView>

commented

Figured it out...

just call the zoom engine and set zoomTo(1, true)