How to Make QR Codes Generated by qrcodejs2 and zxing Consistent in Pixel Alignment?

I am working on a project where QR codes are generated on both the frontend and backend. On the frontend, I am using the qrcodejs2 library, and on the backend, I am using the zxing library(J). However, I need to ensure that the QR codes generated by both libraries are visually consistent in terms of pixel alignment.

Problem Description:

I need to ensure that QR codes generated by qrcodejs2 (JavaScript library on the frontend) and zxing (Java library on the backend) have consistent pixel alignment.(It is necessary to adjust the parameters of the back end so that the QR code generated by the back end and the pixels of the front end are always maintained)
Currently, The QR code scans generated by these libraries are consistent, but their pixels are misaligned
Libraries Used:

qrcodejs2 (JavaScript library for frontend QR code generation)
zxing (Java library for backend QR code generation)
Configuration Details:
java library:

        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>javase</artifactId>
            <version>3.4.1</version>
        </dependency>

js library:
"qrcodejs2": "^0.0.2",

java code:

 public static void generateQRCode(String content, String filePath) throws WriterException, IOException {
        QRCodeWriter qrCodeWriter = new QRCodeWriter();
        Map<EncodeHintType, Object> hints = new HashMap<>();
        hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
        hints.put(EncodeHintType.MARGIN, 1);
        hints.put(EncodeHintType.ERROR_CORRECTION, com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.L);
        BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, 300, 300, hints);
        Path path = FileSystems.getDefault().getPath(filePath);
        MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
    }

    public static void main(String[] args) throws IOException, WriterException {
        generateQRCode(
                "https://www.google.com", "qrcode.png");
    }

js code:

        new QRCode("qrcode2", {
          text: "https://www.google.com",
          width: this.env === 0 ? 160 : 150,
          height: this.env === 0 ? 160 : 150,
          colorDark: "#000000",
          colorLight: "#ffffff",
          correctLevel: QRCode.CorrectLevel.L,
        })

java result
enter image description here

js result
enter image description here