Skip to content

Instantly share code, notes, and snippets.

@philipp-spiess
Created October 17, 2017 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipp-spiess/dbf6290ee3515210afa2dc38e27b5c1a to your computer and use it in GitHub Desktop.
Save philipp-spiess/dbf6290ee3515210afa2dc38e27b5c1a to your computer and use it in GitHub Desktop.
PSPDFKit for Web Code Example
import PSPDFKit, { Geometry } from "pspdfkit"
const instance = await PSPDFKit.load({
container: "#pdf-view",
pdf: "/sales-report.pdf"
});
instance.setViewState(viewState => viewState.zoomIn());
const annotations = await instance.getAnnotations(0);
const point = new Geometry.Point({ x: 20, y: 30 });
const annotationsAtPointInPage = annotationsOnFirstPage.filter(annotation =>
annotation.boundingBox.isPointInside(point)
);
instance.addEventListener("annotations.create", createdAnnotations => {
console.log(createdAnnotations);
});
PSPDFKit.unload("#pdf-view");
@guevarawebgraphics
Copy link

Thank you! I was looking for this PSPDFKit.unload("#pdf-view");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment