-
-
Notifications
You must be signed in to change notification settings - Fork 319
EPS file format isn't providing the right output #274
-
For our design department we created a QRCode generator in our CMS using Chillerlan/php-qrcode. We use PHP Version 7.4 with php-qrcode version 5.0.2. Now they were asking for the file format to be EPS, although it's an old file format and you could just use modern svg.
I used the example provided in Eps.php. The problem is that our design can't open the generated qrcode.eps file in either Adobe Illustrator and InDesign. We have some qrcodes from other generators in EPS file format so I opened both files in an editor to compare them. I noticed that the generated qrcode.eps file from chillerlan/php-qrcode just contains a few lines of xml / html syntax while the qrcodes generated from other files in .eps look more like an actual .eps file. Is there a reason and solution to this?
Below is the code of both .eps files on pastebin:
qrcode.eps (chillerlan):
https://pastebin.com/k1ne0tKB
qrcode.eps (qrcode Monkey):
https://pastebin.com/87M86KQT
Beta Was this translation helpful? Give feedback.
All reactions
That is because the output isn't EPS but SVG, most likely because you're using an example from dev-main. See: https://github.com/chillerlan/php-qrcode?tab=readme-ov-file#documentation
Replies: 1 comment 9 replies
-
That is because the output isn't EPS but SVG, most likely because you're using an example from dev-main. See: https://github.com/chillerlan/php-qrcode?tab=readme-ov-file#documentation
Beta Was this translation helpful? Give feedback.
All reactions
-
@codemasher Hey there again! Could I may ask, if there is an option to exclude some modules from being drawn as the custom shape I defined? Currently I've overwritten the module() method to draw a rhombus-like shape and literally everything will be drawn like that. But I want to draw everything else (especially the finders and their dots) as usual squares.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey, I think this is what you're looking for (see also #150):
php-qrcode/examples/svgWithLogoAndCustomShapes.php
Lines 66 to 76 in c954db6
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
My biggest respect and gratitude that you answer so fast. You seem very dedicated in this wonderful masterpiece of a library! Thank you for your answer! At the same time I have to apologize. I wasted your time, because before you answered I continued searching for an answer myself of course and found the exact same code you just referred to. ^^'
I'm a junior dev, completely new to php (3 months of experience in that language) coming from the C# world so please forgive me my unexperience.
But that leads me to another question. I just used that, but obviously now it's just skipping the finders and leaves them blank (white/not visible). I don't really understand where I can define them to be usual squares.
Beta Was this translation helpful? Give feedback.
All reactions
-
Well we all started at some point haha. Glad to be of help - it's nothing really.
I don't really understand where I can define them to be usual squares.
You just take the bit above that checks for the finder patterns and put it into another if(...) and return the square blocks there.
Basically:
// light module (return empty) if(!$this->drawLightModules && !$this->matrix->isDark($M_TYPE)){ return ''; } // determine position as in the EPS output class // ... // return square shape for the given types if($this->matrix->checkType($x, $y, QRMatrix::M_FINDER) || $this->matrix->checkType($x, $y, QRMatrix::M_FINDER_DOT)){ return sprintf('%d %d %d %d F', $outputX, $outputY, $this->scale, $this->scale); } // return custom shape return '...';
Beta Was this translation helpful? Give feedback.
All reactions
-
Worked all like a hot knife is slicing butter! Thank you so much, I learned a looot today. :) Realized the same thing in png myself at least. To further continue learning myself, next step will be trying to do rounded corners except one for the finders without help.^^
Beta Was this translation helpful? Give feedback.
All reactions
-
🚀 1