Closed keremerkan closed 1 year ago
Hey mate, sorry to hear you're having issues.
I can see the same issues when trying to open your svg on my machine here. Very odd!
I just tried making the same style of QR code that you're showing and exported it to SVG using this code...
func testIssue19ExportSVGIssue() throws {
let d = QRCode.Document(utf8String: "This is a test")
d.design.shape.eye = QRCode.EyeShape.RoundedOuter()
d.design.shape.onPixels = QRCode.PixelShape.Circle()
let str = d.svg(dimension: 600)
try str.write(
to: URL(fileURLWithPath: "/tmp/qrcode.svg"),
atomically: true,
encoding: .utf8
)
}
which generated this file :-
Interestingly, I can view this file correctly in Finder (quicklook), Firefox, Inkscape, Safari and Sketch... these are the apps that I was using to test SVG export.
Can you tell me the settings you're using to generate the QR Code? What pixel style, what eye style? Even better, can you share your code that you're using to create the qr code?
Here's an exact replica of your QR Code in svg (down to the pixels) generated using the current version of the library...
It's very odd. I'm wondering whether there's some combination of settings which is triggering the issue
Ah! Would you possibly be located in a country that uses ',' as the decimal separator?
Because I believe thats the issue with the SVG export. SVG expects '.' as the decimal separator - and I'm using a NumberFormatter to format the float values in the SVG export. The NumberSeparator always uses the Locale to determine the decimal separator, thus it uses ',' which breaks the svg output
Give me a moment...
Hi Darren,
Yes, that's the exact problem. I just came here to write that to say that I found the issue and you are a step ahead of me. My region uses "," instead of "." and the svg was becoming corrupt because of that. I changed the region to US to verify the issue was fixed before even touching my code.
@keremerkan Okey - I've pushed up a new version (13.10.0) which should fix the issue.
Would you mind checking out the new release and see if it fixes your issue please?
Just updated and checked. Opened the file in Adobe Illustrator for good measure. Works perfectly. Thanks!
Brilliant mate. Thank you for reporting it - so glad I can help out.
Apologies for the inconvenience.
Oh and btw. which program in the App Store is using the library? Would be interested in having a look...
The app I used is called QR Pop. The developer seems to utilize your library very well.
BTW, I am adding your library to my app Qrafter which is probably the oldest QR Code app on App Store that still gets regular updates. I just rewrote it using Swift, and your library was the last piece to make it perfect. :) Thank you very much again for creating such an awesome tool.
Always great to hear that. Thank you so much!
Hi Darren,
Just discovered your project and it is incredible, thank you for such an awesome library. However I have encountered a problem with SVG generation. With shapes other than the default squares, SVG output creates unusable images.
I tried it on both my project and an app I found on the App Store, that uses your library. Attached are 2 images for the same QR Code. The SVG is unusable. PNG has no problems. I also tested PDF, and it does not have any problems.
Is this a known issue so we should avoid SVG for designs other than default, or is this a bug?
Best regards.