This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch ISIS-3195 in repository https://gitbox.apache.org/repos/asf/isis.git
commit 58faecb70188e3139c7ffb080e03f0b79ae01337 Author: Dan Haywood <[email protected]> AuthorDate: Mon Aug 29 20:04:39 2022 +0100 ISIS-3194: updates docs --- .../vw/pdfjs/adoc/modules/pdfjs/pages/about.adoc | 43 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/extensions/vw/pdfjs/adoc/modules/pdfjs/pages/about.adoc b/extensions/vw/pdfjs/adoc/modules/pdfjs/pages/about.adoc index 7a2ee4a47d..13ce8ab06b 100644 --- a/extensions/vw/pdfjs/adoc/modules/pdfjs/pages/about.adoc +++ b/extensions/vw/pdfjs/adoc/modules/pdfjs/pages/about.adoc @@ -7,28 +7,55 @@ The PDF.js module integrates with the xref:vw:ROOT:about.adoc[Wicket Viewer], re == Usage -[WARNING] -==== -TODO: v2 - to write up... +To use the extension, annotate an xref:refguide:applib:index/value/Blob.adoc[Blob] property with the xref:refguide:extensions:index/pdfjs/applib/annotations/PdfJsViewer.adoc[@PdfJsViewer] annotation. + +For example: + +[source,xml] +.pom.xml +---- +@PdfJsViewer +@Property() +@PropertyLayout(fieldSetId = "content", sequence = "1") +public Blob getAttachment() { ... } +---- + +IMPORTANT: The `Blob` should only ever return a bytes that correspond to a PDF, with a mime type of "application/pdf". + +Optionally, you can also provide an implementation of the xref:refguide:extensions:index/pdfjs/applib/spi/PdfJsViewerAdvisor.adoc[] SPI, which advises on the size of the viewer (and has callbacks to keep track of which page of the PDF is being viewed). +The framework provides a fallback implementation that sets the height to 800px, and scaled to 75% normal size. -need to annotate property using `@PdfJsViewer` and implement the `PdfJsViewerAdvisor` SPI. -==== == Configuration -Add the following dependency: +Make the following changes: +* In your domain module (containing the domain class that has a `Blob` PDF type), add in the following dependency: ++ [source,xml] .pom.xml ---- <dependency> <groupId>org.apache.isis.extensions</groupId> - <artifactId>isis-extensions-pdfjs-wicket-ui</artifactId> + <artifactId>isis-extensions-pdfjs-applib</artifactId> </dependency> ---- ++ +This will provide access to the xref:refguide:extensions:index/pdfjs/applib/annotations/PdfJsViewer.adoc[@PdfJsViewer] annotation. -Also add the following module to your `AppManifest`: +* And, in the webapp module, add the following dependency: ++ +[source,xml] +.pom.xml +---- +<dependency> + <groupId>org.apache.isis.extensions</groupId> + <artifactId>isis-extensions-pdfjs-wicket-ui</artifactId> +</dependency> +---- +* In your `AppManifest`: ++ [source,java] .AppManifest.java ----
