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

SVG qr code with logo. Logo is not displayed in the Adobe Illustrator #163

Open
Drayfer opened this issue Jan 12, 2023 · 4 comments
Open
Labels
bug Something isn't working

Comments

@Drayfer
Copy link

Drayfer commented Jan 12, 2023

When I download a qr code with a logo in svg format and try to open the image in Adobe Illustrator, an empty space is displayed instead of the logo. The image opens correctly in the browser.
How to solve this problem?
Снимок экрана 2023-01-12 в 20 42 57

@MATTiVOLTARii
Copy link

same Issue

@MATTiVOLTARii
Copy link

I found a workaround. I use qr-code-styling in a Node environment, so I get the data with .getRawData and from there I can change the QR code - to display the png it is enough to rewrite the href as xlink:href.

Otherwise you can also use your SVG, here is an example but the size and position still have to be adjusted:

const svgLogo = fs.readFileSync("media/logo/qr-logo.svg", { encoding: "utf-8" });

     qrCodeSvg.getRawData("svg").then((buffer) => {
       let svgString = buffer.toString('utf8'); // convert buffer to string
       const logoSVG = svgLogo; // SVG code of the logo
      
       //svgString = svgString.replace('<image href="data:image/png;base64', '<image xlink:href="data:image/png;base64');
       svgString = svgString.replace(/<image[^>]*\/>/, `${logoSVG}`); // Insert logo SVG code
    
       const newBuffer = Buffer.from(svgString, 'utf8'); // convert string to buffer
       fs.writeFileSync(svgFile, newBuffer); // Save on computer
     }),

I also have the problem that the QR code is not displayed in black in Illustrator but without color filling, do you know what could be the reason?

@izoukhai
Copy link

@MATTiVOLTARii how did you manage to run the package in a Node environment?

@boerninator
Copy link

Is there an actual solution to this problem? Cant seem to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants