Dmiller35 Posted April 20, 2023 Share Posted April 20, 2023 Our design department occasionally needs to create QR codes for certain print and web customers. They want an easier way to generate a vector QR code than using some website like QR Monkey. I've tried doing it in FP but I run into issues where I can't fill the text frame consistently and almost need to change my font size for each code. When generating the codes, some will create larger barcodes based on the information in the link. I tried using copyfit and while I can get it to enlarge some of them, it doesn't do anything to shrink the font. Is this because copyfit is reading the font size in the text box and not the rule? I feel that the graphic rule really works best but unfortunately I need vector files so that our designers can change the colors if need be. Is there any way to get this to work better or should I find another solution? Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted April 20, 2023 Share Posted April 20, 2023 It doesn't work because the qr rule has an embedded leading tag. The only way I have been able to get around that is to change the leading to use the magnify tag. Convert your QR rule to javascript. Change the return MakeQRBarcode line to the following: var qrcode = MakeQRBarcode(DataToEncode, ProcessTilde, EncodingMode, ErrorCorrectionMode, PreferredFormat, PointSize, NoFontTag, Font); return '<f name="IDAutomation2D"><magnify type="leading" factor=' + 100 / 1.2 + '>' + RawTextFromTagged(qrcode).replace(/\n/g, '<br>') + '</magnify>'; If you are for whatever reason using some non-standard global leading setting that's not 120%, change the 100 / 1.2 to whatever that is. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 20, 2023 Share Posted April 20, 2023 8 hours ago, Dmiller35 said: I feel that the graphic rule really works best but unfortunately I need vector files so that our designers can change the colors if need be. Well, there's really no such thing as a "vector" version of a QR barcode. It's literally one pixel per dot, so emitting vector drawing commands to draw a little black or white box for each dot would be much less efficient than just putting out the raster pixels. But you absolutely can specify the color for the graphic barcode, like so: var QR = new QRBarcode; QR.foreColor = "Red"; QR.backColor = "Blue"; return QR.MakeGraphic("hello"); Or just use the Form rule: If you want it to be a variable color, where you can get the RGB or CMYK color from data, then you can add a new color, called something like Custom, in the Colors dialog, and then create the "Color From Data" Event Form rule to override that custom color based on the data. Quote Link to comment Share on other sites More sharing options...
Dmiller35 Posted April 24, 2023 Author Share Posted April 24, 2023 Thanks Thomas, I'll try that and see if it works. Dan: I should have mentioned that the colors are being changed by our designers. They often don't know what their color needs will be so they just want the ability to change it. They could need to match a customer's color on one project but on another it could need to be white. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.