Package org.nordstjernen
Class Page
java.lang.Object
org.nordstjernen.Page
- All Implemented Interfaces:
AutoCloseable
A laid-out page. Backed by native memory;
close() frees it. Not
thread-safe.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLargest full-page render dimension, in device pixels, to bound memory. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()linkAt(int x, int y) The absolute URL of the link at page coordinates(x, y)in CSS pixels, ornullif there is none.links()All<a href>links on the page as absolute URLs, de-duplicated and in document order.pageSize()Total laid-out page size in CSS pixels.render(int scrollX, int scrollY, int width, int height, double scale) Convenience wrapper aroundrenderRgba(int, int, int, int, double)producing a premultiplied-ARGB image.renderFullPage(double scale) Render the entire page (top to bottom, full width) to a single image atscale.byte[]renderRgba(int scrollX, int scrollY, int width, int height, double scale) Render a viewport region into raw RGBA8888 (premultiplied) bytes,heightrows ofwidth*4bytes.voidrenderToFile(Path path) Render the whole page to a file.text()The rendered text content of the page.title()The page's<title>(whitespace-collapsed), ornull.url()The page's final URL (after redirects).
-
Field Details
-
MAX_FULL_PAGE_PX
public static final int MAX_FULL_PAGE_PXLargest full-page render dimension, in device pixels, to bound memory.- See Also:
-
-
Method Details
-
pageSize
Total laid-out page size in CSS pixels. -
text
The rendered text content of the page. -
title
The page's<title>(whitespace-collapsed), ornull. -
url
The page's final URL (after redirects). -
links
All<a href>links on the page as absolute URLs, de-duplicated and in document order.javascript:and pure-fragment (#…) links are excluded. -
linkAt
The absolute URL of the link at page coordinates(x, y)in CSS pixels, ornullif there is none. -
renderRgba
public byte[] renderRgba(int scrollX, int scrollY, int width, int height, double scale) Render a viewport region into raw RGBA8888 (premultiplied) bytes,heightrows ofwidth*4bytes.- Parameters:
scrollX- CSS-pixel x offset into the pagescrollY- CSS-pixel y offset into the pagewidth- output width in device pixelsheight- output height in device pixelsscale- CSS-pixel to device-pixel scale (1.0 for 1:1)
-
render
Convenience wrapper aroundrenderRgba(int, int, int, int, double)producing a premultiplied-ARGB image. -
renderFullPage
Render the entire page (top to bottom, full width) to a single image atscale. Each dimension is clamped toMAX_FULL_PAGE_PXdevice pixels. -
renderToFile
Render the whole page to a file. A.pdfpath produces a PDF; any other path produces a PNG. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-