Pixel Compare excessive zoom

Viewed 53

I'm working with Pixel Compare extension. It works well with rvt files, and almost with pdfs. When comparing two pdf, the viewer will zoom in on a part of the file and i'm unable to unzoom it. Furthermore, it appears the original file is reduced to the zoomed part.

Examples:

Heres the file before comparing :

And then after, it zooms on the left corner. I cannot access the rest of the file nor zoom out.

I looked for zooming properties on the api docs, but found nothing. Ive honestly no idea what causes it and would welcome any pointer in the right direction.

Thanks in advance.

Edit:

I load pdf this way , Autodesk.Viewing.Initializer not pictured:

viewer1.addEventListener(Autodesk.Viewing.LOADER_LOAD_FILE_EVENT, function (e) {
                        viewer1.loadExtension('Autodesk.PDF').then(() => {
                    
                        viewer1.loadExtension("Autodesk.Viewing.MarkupsCore");
                        viewer1.loadExtension("Autodesk.Viewing.MarkupsGui");
                        
                        
                    });
            });
1 Answers

Have you tried other PDFs, and is this happening to all of them?

I just tried passing two arbitrary PDF files to the extension, and it seems to work fine:

enter image description here enter image description here

If this is just related to a specific set of PDFs you're using, I'd ask you to share those with us (confidentially, we will not share them with anyone outside of Autodesk) via forge (dot) help (at) autodesk (dot) com so that we can debug it locally.

EDIT: here's a simple example of how I initialized the extension for the screenshots above:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.css">
    <title>Autodesk Forge: Pixel Compare</title>
    <style>
        body,
        html {
            margin: 0;
            padding: 0;
            height: 100vh;
        }

        #preview {
            position: absolute;
            width: 100%;
            height: 100%;
        }
    </style>
</head>

<body>
    <div id="preview"></div>
    <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
    <script>
        Autodesk.Viewing.Initializer({ accessToken: '' }, function () {
            const config = {
                extensions: ['Autodesk.Viewing.MarkupsCore', 'Autodesk.Viewing.MarkupsGui']
            };
            const viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('preview'), config);
            viewer.start();
            viewer.loadModel('/path/to/one.pdf', {}, (model1) => {
                viewer.loadModel('/path/to/another.pdf', {}, async (model2) => {
                    const pixelCompareExt = await viewer.loadExtension('Autodesk.Viewing.PixelCompare');
                    pixelCompareExt.compareTwoModels(model1, model2);
                });
            });
        });
    </script>
</body>

</html>

Try using this yourself, just replacing /path/to/one.pdf and /path/to/another.pdf with URLs to your own PDFs.

Related