2019.2 Migration Guide | Web
PSPDFKit for Web 2019.2 comes with a few improvements that might require an ad hoc migration.
Notable Changes
-
We renamed all
*.onPress
events to*.press
to improve consistency with our event naming schema. The old names are now deprecated and will be removed in a future version. The name changes are as follows:-
annotations.onPress
toannotations.press
-
textLine.onPress
totextLine.press
-
page.onPress
topage.press
-
-
Shape annotations had their stroke width scaled when resized with the UI. As a result, the different annotations’ stroke widths could vary if resized. This behavior has been changed, so now a shape annotations’ stroke width is kept when resizing.
-
The default minimum stamp annotation size,
PSPDFKit.Options.MIN_STAMP_ANNOTATION_SIZE
, has been increased from10
to15
. The former value was so small that stamp annotations resized that small would have their text clipped in a way that the stamp text wouldn’t fit (#2977). If your code relies on the former value, you can set it before the firstPSPDFKit.load()
call:PSPDFKit.Options.MIN_STAMP_ANNOTATION_SIZE = 15
. -
In a recent version, we accidentally disabled an optimization that reduces the number of points an ink annotation creates while drawing. This release restores the previous behavior. You can opt out this behavior by setting
PSPDFKit.Options.INK_EPSILON_RANGE_OPTIMIZATION = 0
. -
We renamed
FormField#annotationPdfObjectIds
toFormField#annotationIds
. -
When in continuous scroll mode, we now remove custom overlay items from the DOM if you scroll a certain number of pages below the page they items are rendered on. If you previously depended on custom overlay items being persisted in the DOM (e.g. wanted to maintain its state), you will now have to handle this explicitly with the
CustomOverlayItem#onDisappear
method.For example, if you’re using a
<video>
tag and want to maintain its current position, you could:-
Query the current position in
onDisappear
and apply it again withonAppear
, or -
Move (
appendChild
) the<video>
node to another place in the DOM (e.g. an invisible div outside the viewport) and append it back to the custom overlay itemonAppear
. This will keep most of the state around.
-
-
We moved the public CSS classes for shape annotations and ink annotations from their
svg
element to their container (parent).
If you use PSPDFKit Server, please make sure you read the 2019.2 Server Migration Guide.
For a full list of changes, check out the changelog.