You said:
ChatGPT said:
बहुत बढ़िया — नीचे मैंने CorelDRAW के लिए एक सरल VBA macro (micro → macro) का कोड दिया है जो एक साफ़-सुथरा ID-card टेम्पलेट बनाएगा: कार्ड बॉर्डर, फोटो के लिए placeholder (frame), नाम/पद/कंपनी के टेक्स्ट फ़ील्ड और एक छोटे से QR/barcode placeholder। साथ में स्टेप-बाय-स्टेप हिंदी में बताया है कि इस macro को कहाँ पेस्ट करें और फोटो/डाटा कैसे डालकर इस्तेमाल करें।
नोट: CorelDRAW में फोटो को सही तरह से रखने के लिए आप आसानी से फोटो को
PowerClipसे frame के अंदर डाल सकते हैं — नीचे उस प्रक्रिया भी दी है। अगर आपका CorelDRAW हिंदी/वर्ज़न अलग बोले तो मेनू नाम थोड़े अलग हो सकते हैं लेकिन idea वही रहेगा।
1) Macro (VBA) — कोड
' CorelDRAW VBA macro: Simple ID Card Template Creator
' Instructions: Paste this into a new Module in CorelDRAW's VBA editor and Run the "CreateIDCard" macro.
Option Explicit
Sub CreateIDCard()
Dim doc As Document
Set doc = ActiveDocument
' ensure units in millimeters (optional)
doc.Unit = cdrMillimeter
Dim layer As Layer
Set layer = doc.ActiveLayer
' Card size (example): 85 mm x 54 mm (standard credit-card size)
Dim cardW As Double: cardW = 85
Dim cardH As Double: cardH = 54
Dim margin As Double: margin = 4
' Create card background (rounded rectangle)
Dim card As Shape
Set card = layer.CreateRoundedRectangle(0, 0, cardW, cardH, 3, 3)
card.Fill.UniformColor.RGBAssign 255, 255, 255 ' white
card.Outline.SetNoOutline
' Add subtle border
Dim border As Shape
Set border = layer.CreateRoundedRectangle(0.5, 0.5, cardW - 0.5, cardH - 0.5, 2.5, 2.5)
border.Fill.SetNoFill
border.Outline.Width = 0.35
border.Outline.Color.RGBAssign 50, 50, 50
' Photo placeholder (rectangle) - placed left
Dim photoX As Double: photoX = margin
Dim photoY As Double: photoY = margin
Dim photoW As Double: photoW = 28
Dim photoH As Double: photoH = 36
Dim photoFrame As Shape
Set photoFrame = layer.CreateRectangle(photoX, photoY, photoX + photoW, photoY + photoH)
photoFrame.Fill.SetNoFill
photoFrame.Outline.Width = 0.8
photoFrame.Outline.Color.RGBAssign 120, 120, 120
photoFrame.Text.Story = "" ' no text in frame
' Instruction text (small) inside photo frame (visible as placeholder text)
Dim instr As Shape
Set instr = layer.CreateArtisticText(photoX + photoW/2, photoY + photoH/2, "Place photo → Import & PowerClip", , "Arial", 6)
instr.Text.Alignment = cdrTextAlignmentCenter
instr.SetPosition photoX + photoW/2, photoY + photoH/2
' Name (big)
Dim nameX As Double: nameX = photoX + photoW + 6
Dim nameY As Double: nameY = photoY + 4
Dim nameText As Shape
Set nameText = layer.CreateArtisticText(nameX, nameY, "Full Name Here", , "Arial", 12)
nameText.Text.Story = "ASHUTOSH VISHWAKARMA"
nameText.Text.CharacterProperties.Bold = True
' Designation / Role
Dim roleText As Shape
Set roleText = layer.CreateArtisticText(nameX, nameY + 8, "Designation / Role", , "Arial", 8)
roleText.Text.Story = "Senior Designer"
' Company name / Dept
Dim compText As Shape
Set compText = layer.CreateArtisticText(nameX, nameY + 16, "Company / Department", , "Arial", 7)
compText.Text.Story = "ACME CREATIVE STUDIO"
' Small barcode/QR placeholder at bottom-right
Dim codeW As Double: codeW = 24
Dim codeH As Double: codeH = 12
Dim codeX As Double: codeX = cardW - margin - codeW
Dim codeY As Double: codeY = cardH - margin - codeH
Dim codeFrame As Shape
Set codeFrame = layer.CreateRectangle(codeX, codeY, codeX + codeW, codeY + codeH)
codeFrame.Fill.SetNoFill
codeFrame.Outline.Width = 0.35
codeFrame.Outline.Color.RGBAssign 120, 120, 120
Dim codeInstr As Shape
Set codeInstr = layer.CreateArtisticText(codeX + 1, codeY + codeH/2 - 2, "QR/BARCODE", , "Arial", 6)
codeInstr.Text.Story = "QR / BARCODE"
' Optional: Employee ID small text under name
Dim idText As Shape
Set idText = layer.CreateArtisticText(nameX, nameY + 26, "ID: 000123", , "Arial", 7)
idText.Text.Story = "ID: 000123"
' Align everything to the card group and move to comfortable position
Dim grp As Shape
Set grp = layer.CreateGroupFromShapes(Array(card, border, photoFrame, instr, nameText, roleText, compText, codeFrame, codeInstr, idText))
grp.SetPosition 10, 10 ' move group inside document so you see it clearly
' Set document guidelines (optional): center line
Dim g1 As Guide
Set g1 = doc.Guides.AddVertical((10 + cardW/2) , cdrGuideInPageCoordinates)
MsgBox "ID card template created. \n\nNext steps:\n1) Import a photo (File > Import) and PowerClip it into the photo frame.\n2) Edit the text fields by selecting them and typing.\n3) Export: File > Publish To PDF or File > Export (PNG/JPEG).", vbInformation, "Done"
End Sub
2) Macro को CorelDRAW में कैसे डालें और चलाएँ (Step-by-step — हिंदी)
CorelDRAW खोलें और जिस डॉक्यूमेंट में कार्ड बनाना हो वो खोलें (या नया डॉक्यूमेंट बनाएँ)।
मेनू: Tools → Macros → Macro Editor (या Alt+F11) खोलें।
VBA Editor में: Insert → Module चुनें। नया Module खुलेगा।
ऊपर दिया गया पूरा कोड कॉपी-पेस्ट करें उस Module में।
Save करें और VBA Editor बंद करें।
CorelDRAW में: Tools → Macros → Run Macro और
CreateIDCardचुनकर Run करें।
— Macro चलने पर एक ID-card टेम्पलेट आपका डॉक्यूमेंट में आ जाएगा और एक message box बताएगा अगले steps।
3) फोटो (image) कैसे डालें और सही तरीके से फिट करें (PowerClip)
File → Import (या Ctrl+I) → अपनी फ़ोटो चुनें → क्लिक करके डॉक्यूमेंट में place करें।
फ़ोटो को approximate जगह पर ले जाएँ और उसे select करें।
अब फोटो पर राइट-क्लिक → PowerClip Inside → फिर उस फोटो-frame (placeholder) पर क्लिक करें — इससे फोटो frame के अंदर clip हो जाएगा।
PowerClip के अंदर फोटो reposition/resize करने के लिए: Right-click on the PowerClip → Edit PowerClip → अब फोटो select करके
Arrange → Transformया corner से resize करें। किया तो Right-click → Finish Editing This PowerClip।
Tip: फोटो को स्लाइड/फिट करने के लिए
Fit To FrameयाCenter To Frameविकल्प इस्तेमाल कर सकते हैं (CorelDRAW के Version पर निर्भर).
4) टेक्स्ट/डिटेल्स बदलना और प्रिंट/एक्सपोर्ट
Text बदलने के लिए Text tool चुनकर उस टेक्स्ट ऑब्जेक्ट पर क्लिक करें और लिख दें। आप font, size, color बदल सकते हैं Properties bar से।
कई ID कार्ड्स के लिए (batch) डाटा मेल-merge करना हो तो CorelDRAW में
Print Mergeफीचर use करें (Tools → Print Merge) — यह एक Excel/CSV से नाम, ID, फोटो पाथ इत्यादि लेकर multiple cards बनाना आसान बनाता है.एक्सपोर्ट/प्रिंट:
File → Publish to PDF(याFile → Export→ PNG/JPEG). प्रिंट के लिए Bleed/Printer settings ध्यान रखें।
5) और कस्टमाइज़ेशन सुझाव (तेज़ तरीके)
फोटो को गोल में चाहिए? Placeholder ellipse बनाइए और user photo को PowerClip के अंदर ellipse में डालें।
कंपनी logo के लिए एक छोटा rectangle/placeholder ऊपर छोड़ दें, और वहां
Importकर के place करें।Barcode/QR: CorelDRAW के built-in Barcode/Barcode Wizard या तृतीय-पक्ष plugin से QR/barcode generate करें और उसे codeFrame के अंदर रख दें। (या Print Merge से unique के लिए अलग field इस्तेमाल करें)।
रंग, rounded corners, shadow इत्यादि Properties bar से आसानी से बदल सकते हैं।
अगर आप चाहें तो मैं:
यही macro को थोड़ा और उन्नत कर दूँ — जैसे कि एक input-form (InputBox) पूछकर नाम, पद, ID और फोटो path सीधे macro में डाल दे और Auto-import/PowerClip करने की कोशिश करे; या
आपको Print-Merge के लिए एक Excel template बनाकर दे दूँ (नाम, id, photo filepath columns सहित) और बताऊँ कि कैसे Corel में उससे batch ID कार्ड निकालें।
बताइए किस विकल्प में आगे बढ़ना है — मैं वही करके code और step-by-step दे दूँगा।


0 Comments