最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Annotations on Adobe PDF Embed API not working on some tablets - Stack Overflow

programmeradmin4浏览0评论

I'm trying to get annotations to work on a PDF Embed API implementation. The documentation says that in FULL_WINDOW mode it should work on Chrome and Safari on Tablets. However it does not seem to work in Chrome on any Android Tablet.

I've tried on multiple Android tablets using Chrome, and none of them have the annotation tools pop up. However the annotation tools pop up fine on a standard PC, on an iPad Pro, and on a Surface Tablet. Am I doing something wrong? Or is the documentation inaccurate, and Chrome on Android is not supported for annotations?

My script is below. There are other things on the page as well, including the DIV called 'adobe-dc-view' which appears to be standard, but this is the relevant script for embedding the PDF with annotations capacity.

Any advice is welcome.

<script src=".js"></script>
<script type="text/javascript">
    const previewConfig = {
            embedMode: "FULL_WINDOW",
            showDownloadPDF: false,
            showPrintPDF: false,
            showAnnotationTools: true,
            enableAnnotationAPIs: true,
            includePDFAnnotations: true,
            showFullScreenViewButton: true
        };
    const saveOptions = {
            autoSaveFrequency: 0,
            enableFocusPolling: false,
            showSaveButton: true
        };
    
    document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
        var adobeDCView = new AdobeDC.View({clientId: "HIDDEN FOR SECURITY", divId: "adobe-dc-view"});
        adobeDCView.registerCallback(
            AdobeDC.View.Enum.CallbackType.SAVE_API,
            function(metaData, content, options) {
                var uint8Array = new Uint8Array(content);
                var blob = new Blob([uint8Array], { type: 'application/pdf' });
                formData = new FormData();
                <<FORM INFORMATION I SEND>>;
                fetch("/i-use-for-saving",{
                    method: 'POST',
                    body: formData,
                })
                    .then(
                        function (response) {
                            if (response.status == 200) {
                                console.log(response.body);
                            }
                        }
                    )

                return new Promise((resolve, reject) => {
                    resolve({
                        code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                        data: {
                            metaData: {
                                fileName: "PDFFILE.pdf",
                                id: "fancy-id"
                            }
                        }
                    });
                });
            },
            saveOptions
        );
        adobeDCView.previewFile({
            content:{location: {url: ";}},
            metaData: {
                fileName: "THEPDF.pdf",
                id: "fancy-id"
            }
        }, previewConfig)
            .then(adobeViewer => {
                adobeViewer.getAnnotationManager().then(annotationManager => {
                    annotationManager.setConfig({downloadWithAnnotations: true})
                    annotationManager.startAnnotationMode('shape',{
                        defaultColor: "#000000",
                        cursor: "crosshair",
                        strokeWidth: 2
                    });
                    annotationManager.registerEventListener(
                        function(event) {
                            annotationManager.startAnnotationMode('shape',{
                                defaultColor: "#000000",
                                cursor: "crosshair"
                            });
                        }, {
                            listenOn: [ AdobeDC.View.Enum.AnnotationEvents.ANNOTATION_MODE_ENDED ],
                            enableAnnotationEvents: true
                        }
                    );
                });
            });
    });

</script>

View on Samsung Galaxy Tab - No Annotation Tools View on iPad Pro - Annotation Tools Appear

发布评论

评论列表(0)

  1. 暂无评论