JavaScript
- 1 ответ
- 0 вопросов
1
Вклад в тег
// Loading document.
PDFJS.getDocument(DEFAULT_URL).then(function (pdfDocument) {
// Document loaded, retrieving the page.
return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
// Creating the page view with default parameters.
var pdfPageView = new PDFJS.PDFPageView({
container: container,
id: PAGE_TO_VIEW,
scale: SCALE,
defaultViewport: pdfPage.getViewport(SCALE),
// We can enable text/annotations layers, if needed
textLayerFactory: new PDFJS.DefaultTextLayerFactory(),
annotationLayerFactory: new PDFJS.DefaultAnnotationLayerFactory()
});
// Associates the actual page with the view, and drawing it
pdfPageView.setPdfPage(pdfPage);
return pdfPageView.draw();
});
});
import { AnnotationLayerBuilder } from 'pdfjs-dist/lib/web/annotation_layer_builder';
import { SimpleLinkService} from 'pdfjs-dist/lib/web/pdf_link_service';
import NullL10n from 'pdfjs-dist/lib/web/ui_utils.js';
var annotateMeta = page.getAnnotations().then(function (data) {
var annotation = new AnnotationLayerBuilder({
pageDiv: textcontainer,
linkService: new SimpleLinkService(),
pdfPage: page,
l10n: NullL10n
})
annotation .render(viewport);
});