Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to convert the synctex coordinate to react-pdf-highlighter coordinate #252

Open
jiangxiaoqiang opened this issue Oct 14, 2023 · 0 comments

Comments

@jiangxiaoqiang
Copy link

jiangxiaoqiang commented Oct 14, 2023

Now I am get the coordinate from synctex and then convert it to react-pdf-highlighter coordinate like this:

const clientCoordinate = (position: PdfPosition[]) => {
        var hl = new Array<IHighlight>;
        position.forEach((item: PdfPosition) => {
            let sc: Scaled = {
                x1: item.h,
                y1: item.v,
                x2: item.x,
                y2: item.y,
                width: item.width,
                height: item.height
            };
            let sca = new Array();
            sca.push(sc);
            var pos: ScaledPosition = {
                pageNumber: item.page,
                usePdfCoordinates: true,
                boundingRect: sc,
                rects: sca
            };
            var hightLight: IHighlight = {
                id: uuidv4.toString(),
                position: pos,
                content: {},
                comment: {
                    text: 'Flow or TypeScript?',
                    emoji: '🔥'
                }
            };
            hl.push(hightLight);
        });
        return hl;
    }

seems the synctex coordinate not match with the react-pdf-highlighter coordinate, I have tried both pdf coordinate and not pdf coordinate. does anyone facing the same issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant