Skip to content

Instantly share code, notes, and snippets.

@kmrobin
kmrobin / PDFSearchScript.js
Last active May 24, 2020 03:50
AEM PDF Search & Preview (JS)
//Include the View SDK JS from https://documentcloud.adobe.com/view-sdk/main.js
const viewerConfig = { //You can make these options configurable and read them from AEM Dialog
showAnnotationTools: true, enableFormFilling: true, showLeftHandPanel: true, showDownloadPDF: true, showPrintPDF: true, showPageControls: true,dockPageControls: true, defaultViewMode: "FIT_WIDTH"
};
function initializePDF(pdfFilePath, title) {
var adobeDCView = new AdobeDC.View({ clientId: "<YOUR_VIEW_SDK_CLIENT_ID>", divId: "adobe-dc-view", reportSuiteId: "<YOUR_ANALYTICS_REPORT_SUITE_ID>"});
adobeDCView.previewFile({content:{location: {url: pdfFilePath}}, metaData:{fileName: title}}, viewerConfig);
adobeDCView.registerCallback(
AdobeDC.View.Enum.CallbackType.EVENT_LISTENER,
function(event) { if(event.type=="APP_RENDERING_DONE"){ // Your custom logic after PDF Rendering completes}},
@kmrobin
kmrobin / pdfsearch.html
Last active May 24, 2020 03:48
AEM PDF Search & Preview (HTL)
<!-- An Example snippet for AEM PDF Search & Preview Component -->
<div class="col-md-3 left-div">
<div data-sly-resource="${'search' @ resourceType='foundation/components/search'}"></div>
</div>
<div class="col-md-9 right-div" id="adobe-dc-view">Select a result to preview the PDF here</div>
@kmrobin
kmrobin / PDFViewerScript.js
Last active May 24, 2020 03:46
AEM PDF Viewer Component (JS)
$(document).ready(function() {
document.addEventListener("adobe_dc_view_sdk.ready", initializePDF);
function initializePDF() {
var pdffile = $('#pdffile').val();
var title = $('#title').val();
var viewmode = $('#viewmode').val();
var viewerConfig = {
showAnnotationTools: true,
enableFormFilling: true,
showLeftHandPanel: true,
@kmrobin
kmrobin / pdfviewer.html
Last active May 17, 2020 07:56
PDF Viewer Component for AEM (HTL)
<div data-sly-test="${wcmmode.edit && !properties.pdfviewerFlag}" class="cq-placeholder" data-emptytext="PDF Viewer Component"></div>
<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
<div data-sly-use.clientlib="${'/libs/granite/sightly/templates/clientlib.html'}" data-sly-unwrap>
<div data-sly-call="${clientlib.all @ categories='myproject.pdfviewer'}" data-sly-unwrap></div>
<div class="row">
<input type="hidden" name="pdffile" id="pdffile" value="${properties.pdffile}"/>
<input type="hidden" name="title" id="title" value="${properties.title || currentPage.title || pageProperties.jcr:title}"/>
<input type="hidden" name="viewmode" id="viewmode" value="${properties.inline}"/>
<div class="col-sm-12" id="adobe-dc-view" style="height:900px; text-align:center">
@kmrobin
kmrobin / twitter_iframe.html
Last active June 16, 2017 04:39
Twitter Tweet Button in iFrame
<iframe id="tweet-button" allowtransparency="true" frameborder="0" scrolling="no"
src="http://platform.twitter.com/widgets/tweet_button.html?via=Robin&amp;text="This is my Tweet"&amp;count=horizontal"
style="width:110px; height:20px;"></iframe>
https://1drv.ms/x/s!AuLCIF0jtl9Ew2TSOfNjQGtG5XgI
@kmrobin
kmrobin / Oak Datastore Check.md
Created August 7, 2016 09:30 — forked from andrewmkhoury/Oak Datastore Check.md
Oak Datastore Consistency Check
  1. Download the oak-run version that matches what is installed from http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
  2. Stop all AEM instances in cluster
  3. Upload the oak-run jar to the AEM server
  4. Run this command to start the oak console
  • on TarMK:
   java -Xmx4g -jar target/oak-run.jar console --quiet /path/to/segmentstore
  • For MongoMK run this: