Class Pdfviewer
- All Implemented Interfaces:
Serializable,Cloneable,Component,Scope,ComponentCtrl,Pageable
Only works for browsers supporting HTML5 (Firefox, Chrome, Opera, IE 11, Edge, Safari...).
Available in ZK PE and ZK EE.
Default getZclass(): z-pdfviewer.
- Since:
- 9.0.0
- Author:
- rudyhuang
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA utility class to implementHtmlBasedComponent.getExtraCtrl().Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo -
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeChildAdded(Component child, Component insertBefore) Default: does nothing.booleanGo to the first page.intReturns the active page (starting from 0).Returns the content set bysetContent(org.zkoss.util.media.Media).Returns the client control for this component.intReturns the number of pages.intReturns the number of items per page.getPropertyAccess(String prop) Returns the corresponding property access object from the given property name, if any.intReturns the rotation angle.getSrc()Returns the source URI of the PDF file.Returns the ZK Cascading Style class for this component.doublegetZoom()Returns the zoom level.booleanlastPage()Go to the last page.booleannextPage()Go to the next page.voidonChildAdded(Component child) Default: handles special event listeners.voidonChildRemoved(Component child) Default: handles special event listeners.booleanGo to the previous page.protected voidrenderProperties(ContentRenderer renderer) Renders the content of this component, excluding the enclosing tags and children.voidRotates 90 degrees clockwise.voidRotates 90 degrees counterclockwise.voidProcesses an AU request.voidsetActivePage(int page) Sets the active page (starting from 0).voidsetContent(Media content) Sets the content.voidsetPageSize(int size) Sets the number of items per page.voidsetRotation(int rotation) Sets the rotation angle.voidSets the source URI of the PDF file.voidsetZoom(double zoom) Sets the zoom level.voidSets the zoom level.booleanzoomIn()Zoom in by 10%.booleanzoomOut()Zoom out by 10%.Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
Pdfviewer
public Pdfviewer()
-
-
Method Details
-
getSrc
Returns the source URI of the PDF file.Default: null.
-
setSrc
Sets the source URI of the PDF file.Calling this method implies setContent(null). In other words, the last invocation of setSrc overrides the previous
setContent(org.zkoss.util.media.Media), if any. -
getContent
Returns the content set bysetContent(org.zkoss.util.media.Media).Default: null.
Note: it won't fetch what is set thru by
setSrc(java.lang.String). It simply returns what is passed tosetContent(org.zkoss.util.media.Media). -
setContent
Sets the content.Calling this method implies setSrc(null). In other words, the last invocation of setContent overrides the previous
setSrc(java.lang.String), if any. -
getActivePage
public int getActivePage()Description copied from interface:PageableReturns the active page (starting from 0).- Specified by:
getActivePagein interfacePageable
-
setActivePage
Description copied from interface:PageableSets the active page (starting from 0).- Specified by:
setActivePagein interfacePageable- Throws:
WrongValueException
-
getZoom
public double getZoom()Returns the zoom level.Default: 1.0.
-
setZoom
public void setZoom(double zoom) Sets the zoom level. -
setZoom
Sets the zoom level.- Parameters:
zoom- fit-page-width or fit-page-height- Since:
- 9.6.0
-
getRotation
public int getRotation()Returns the rotation angle.Default: 0.
-
setRotation
public void setRotation(int rotation) Sets the rotation angle.- Parameters:
rotation- rotation angle. Only 0, 90, 180 and 270 are accepted.
-
renderProperties
Description copied from class:HtmlBasedComponentRenders the content of this component, excluding the enclosing tags and children.- Overrides:
renderPropertiesin classXulElement- Throws:
IOException
-
getPageSize
public int getPageSize()Returns the number of items per page.Default: 1.
- Specified by:
getPageSizein interfacePageable
-
setPageSize
Sets the number of items per page.It is readonly in pdfviewer.
- Specified by:
setPageSizein interfacePageable- Throws:
WrongValueException
-
getPageCount
public int getPageCount()Description copied from interface:PageableReturns the number of pages. Note: there is at least one page even no item at all.- Specified by:
getPageCountin interfacePageable
-
firstPage
public boolean firstPage()Go to the first page.- Returns:
trueif the action was successful.
-
previousPage
public boolean previousPage()Go to the previous page.- Returns:
trueif the action was successful.
-
nextPage
public boolean nextPage()Go to the next page.- Returns:
trueif the action was successful.
-
lastPage
public boolean lastPage()Go to the last page.- Returns:
trueif the action was successful.
-
zoomIn
public boolean zoomIn()Zoom in by 10%.- Returns:
trueif the action was successful.
-
zoomOut
public boolean zoomOut()Zoom out by 10%.- Returns:
trueif the action was successful.
-
rotateClockwise
public void rotateClockwise()Rotates 90 degrees clockwise. -
rotateCounterclockwise
public void rotateCounterclockwise()Rotates 90 degrees counterclockwise. -
service
Description copied from class:HtmlBasedComponentProcesses an AU request.Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
- Specified by:
servicein interfaceComponentCtrl- Overrides:
servicein classHtmlBasedComponenteverError- whether any error ever occurred before processing this request.- See Also:
-
beforeChildAdded
Description copied from class:AbstractComponentDefault: does nothing.- Specified by:
beforeChildAddedin interfaceComponentCtrl- Overrides:
beforeChildAddedin classAbstractComponent- Parameters:
child- the child to be added (never null).insertBefore- another child component that the new child will be inserted before it. If null, the new child will be the last child.- See Also:
-
onChildAdded
Description copied from class:AbstractComponentDefault: handles special event listeners.- Specified by:
onChildAddedin interfaceComponentCtrl- Overrides:
onChildAddedin classAbstractComponent- See Also:
-
onChildRemoved
Description copied from class:AbstractComponentDefault: handles special event listeners.- Specified by:
onChildRemovedin interfaceComponentCtrl- Overrides:
onChildRemovedin classAbstractComponent- See Also:
-
getZclass
Description copied from class:HtmlBasedComponentReturns the ZK Cascading Style class for this component. It usually depends on the implementation of the mold (AbstractComponent.getMold()).Default: null (the default value depends on element).
HtmlBasedComponent.setZclass(java.lang.String)) will completely replace the default style of a component. In other words, the default style of a component is associated with the default value ofHtmlBasedComponent.getZclass(). Once it is changed, the default style won't be applied at all. If you want to perform small adjustments, useHtmlBasedComponent.setSclass(java.lang.String)instead.- Overrides:
getZclassin classHtmlBasedComponent- See Also:
-
getExtraCtrl
Description copied from class:HtmlBasedComponentReturns the client control for this component. It is used only by component developers.Default: creates an instance of
HtmlBasedComponent.ExtraCtrl.- Specified by:
getExtraCtrlin interfaceComponentCtrl- Overrides:
getExtraCtrlin classHtmlBasedComponent- Returns:
- null if no special handling required. If the component
requires some special controls, it could return an object that
implements one or several interfaces in the org.zkoss.zk.ui.ext.render
package.
For example,
Cropper. - See Also:
-
getPropertyAccess
Description copied from interface:ComponentCtrlReturns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccessin interfaceComponentCtrl- Overrides:
getPropertyAccessin classXulElement- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-