Please create a new teacher's book with all the answers in it from student's textbbook exercises,the teacher's book has got 5 pages pdf for you to understand and differentiate between student's book and teacher's book,also please create red background and white text for proper full answers already give in teacher's book from student's book and yellow background with black text in it for answers not given in teacher's book and you have to create it for me from exercises of student's book.I am adding 2 files for you which you can use to create answers for exercises not given in teacher's book.
~/
~/attachments
~/attachments/99393f7c-9856-4e70-91c0-8253521e8a16
python -c "from pypdf import PdfReader; from pathlib import Path; root=Path('/tmp/workspace/attachments/99393f7c-9856-4e70-91c0-8253521e8a16'); [(print('\n###',p.name,'PAGES',len(PdfReader(str(p)).pages)), print(''.join((pg.extract_text() or '') for pg in PdfReader(str(p)).pages)[:12000])) for p in sorted(root.glob('*.pdf'))]"
mkdir -p "/tmp/workspace/cities-teacher-book/src" "/tmp/workspace/cities-teacher-book/output" && python -c "from pypdf import PdfReader; from pathlib import Path; root=Path('/tmp/workspace/attachments/99393f7c-9856-4e70-91c0-8253521e8a16'); out=Path('/tmp/workspace/cities-teacher-book/src'); [(out/(p.stem+'.txt')).write_text(''.join(f'\n\n===== PAGE {i+1} =====\n\n'+(pg.extract_text() or '') for i,pg in enumerate(PdfReader(str(p)).pages))) for p in root.glob('*.pdf')]"
"Answers" in ~/cities-teacher-book/src
DOC-20260829-WA0027.pdf - pages 6 to 11 of Unit 1, CitiesDOC-20260829-WA0026.pdf - includes supplied answers for the same exercisesContinue please,I want my pdf fast
Create the completed color-coded teacher’s book PDF now
~/
~/cities-teacher-book
mkdir -p "/tmp/workspace/cities-teacher-book/output" && python - <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, KeepTogether, PageBreak from reportlab.pdfbase.pdfmetrics import stringWidth from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfbase import pdfmetrics from reportlab.pdfgen.canvas import Canvas from pathlib import Path out=Path('/tmp/workspace/cities-teacher-book/output/Cities_Unit_1_Colour_Coded_Teachers_Book.pdf') RED=colors.HexColor('#B00020'); YELLOW=colors.HexColor('#FFE55C'); NAVY=colors.HexColor('#17365D'); GREY=colors.HexColor('#F3F5F7') styles=getSampleStyleSheet() base=ParagraphStyle('base', parent=styles['BodyText'], fontName='Helvetica', fontSize=9.2, leading=12, spaceAfter=4) title=ParagraphStyle('title', parent=styles['Title'], fontName='Helvetica-Bold', fontSize=22, leading=26, textColor=NAVY, alignment=TA_CENTER, spaceAfter=10) sub=ParagraphStyle('sub', parent=base, fontName='Helvetica', fontSize=10, leading=14, alignment=TA_CENTER, textColor=colors.HexColor('#444444')) h=ParagraphStyle('h', parent=styles['Heading2'], fontName='Helvetica-Bold', fontSize=14, leading=17, textColor=NAVY, spaceBefore=10, spaceAfter=5) small=ParagraphStyle('small', parent=base, fontSize=8.2, leading=10.5) white=ParagraphStyle('white', parent=base, textColor=colors.white) black=ParagraphStyle('black', parent=base, textColor=colors.black) def esc(t): return t.replace('&','&').replace('<','<').replace('>','>') def block(label, text, supplied=True): bg=RED if supplied else YELLOW; st=white if supplied else black lines=[f'<b>{esc(label)}</b>']+text.split('\n') paras=[] for i,line in enumerate(lines): pstyle=ParagraphStyle('tmp', parent=st, spaceAfter=3 if i else 5, fontSize=9 if i else 10, leading=12) paras.append(Paragraph(esc(line).replace('•','•'),pstyle)) def draw(c,w,h): c.saveState(); c.setFillColor(bg); c.roundRect(0,0,w,h,6,stroke=0,fill=1); c.restoreState() from reportlab.platypus import Flowable class Box(Flowable): def __init__(self, content): Flowable.__init__(self); self.content=content; self.width=0; self.height=0 def wrap(self,availW,availH): self.width=availW; total=14 for p in self.content: _,hh=p.wrap(availW-20,availH); total+=hh self.height=total; return availW,total def draw(self): self.canv.saveState(); self.canv.setFillColor(bg); self.canv.roundRect(0,0,self.width,self.height,7,stroke=0,fill=1); self.canv.restoreState() y=self.height-8 for p in self.content: w,hh=p.wrap(self.width-20,self.height); y-=hh; p.drawOn(self.canv,10,y) return Box(paras) story=[] story += [Paragraph('CITIES - UNIT 1',title),Paragraph('Colour-Coded Teacher’s Answer Book | Student’s Book pages 6-11',sub),Spacer(1,12)] story.append(block('HOW TO USE THIS BOOK','RED with white text: answer, example answer, or key directly supplied in the provided Teacher’s Book pages.\nYELLOW with black text: suggested answer prepared for an activity where no fixed answer was supplied. These can be adapted to students’ local context.',False)) story.append(Spacer(1,9)) story.append(Paragraph('1A - A real buzz about the place',h)) story.append(block('Speaking 1 - Suggested answer','The place looks affluent, peaceful, spotless, residential, compact and well-run. It also seems rather expensive and possibly a little dull.',True)) story.append(block('Speaking 2 - Suggested answer','Advantages: residents may feel safe; the surroundings look attractive; homes appear comfortable.\nDrawbacks: the cost of living may be high; the lifestyle may be slow-paced; there may be limited nightlife or public transport.',True)) story.append(block('Speaking 3 - Suggested answer','Answers will vary. Model: “Unlike my neighbourhood, this place has more detached homes and green space. Both places look residential, but mine is more crowded and lively.”',False)) story.append(Paragraph('Vocabulary - City life',h)) story.append(block('Exercise 1 - Meanings','springing up = appearing suddenly; buzz = a positive, exciting feeling; grand houses = large houses; gated apartments = apartments behind controlled gates; transport infrastructure = physical transport systems; runs very smoothly = functions very well; smog = polluted fog; choke on the fumes = struggle to breathe because of exhaust pollution; trace = a very small amount; littering = dropping rubbish in public; grinds to a halt = stops; gentrification = renewal that attracts wealthier residents; settling down = beginning to live permanently somewhere; neglected = not cared for; derelict = ruined or abandoned; outskirts = areas outside a city; crammed = forced into a small space; dingy = dark and dirty.',True)) story.append(block('Exercise 2.1-6 - Example answers','1 People, vehicles, colours, music, restaurants, cafés and bars.\n2 Buildings being left to decay, or no new buildings being built.\n3 Bridges, water supplies, electricity grids and telecommunications.\n4 A production process, a business, a machine or a web server.\n5 Improved services and facilities, new bus lines and stops, road improvements.\n6 Public-service decline, more litter, broken signs, less spending, jobs moving away, or transport networks changing.',True)) story.append(block('Exercise 2.7 - Answers','1 up-and-coming, vibrant 2 affluent 3 well-run 4 polluted 5 spotless, well-run 6 chaotic, congested 7 up-and-coming 8 run-down 9 sprawling 10 deprived, congested',True)) story.append(PageBreak()) story.append(Paragraph('1A - Listening, grammar and speaking',h)) story.append(block('Listening Exercise 3 - Answers','Conversation 1\nPositive: crazy nightlife; the city is buzzing at 4 a.m.; downtown is vibrant.\nNegative: terrible traffic; humid and difficult to walk around; polluted.\n\nConversation 2\nPositive: affluent; good for bringing up children; clean; everything runs smoothly.\nNegative: conservative and affluent; dull; not much going on; no music scene.',True)) story.append(block('Listening Exercise 4 - Suggested answer','The first place could be a very large, hot and heavily congested city, perhaps Bangkok, because of its nightlife, neon lights, smog and humidity. The second could be an affluent commuter town. Personal preference answers will vary.',False)) story.append(block('Listening Exercise 5 - Answers','1 took me by surprise\n2 in the early hours\n3 might as well\n4 it’s like hitting\n5 have its drawbacks\n6 that sort of place\n7 more of a music scene\n8 consider going back\n9 get me wrong\n10 were to settle down',True)) story.append(block('Speaking Exercise 6 - Suggested answers','Answers are personal. Encourage students to use: take me by surprise; in the early hours; drawbacks; music / nightlife scene; settle down.\nModel: “The crowds and skyscrapers in Dubai took me by surprise. A good place to settle down in my region is a small town near the coast because it is peaceful but still well connected.”',False)) story.append(block('Grammar Exercise 7 - Corrections','1 There are some <b>very / really</b> fancy shops around there.\n2 There was just a <b>real</b> buzz about the place.\n3 Correct: It was just a simply amazing thing to experience - an absolute dream come true.\n4 The area is incredibly quiet and the streets are <b>absolutely / completely / utterly / really</b> deserted at night.\n5 It was <b>really, really</b> run-down, with some buildings just completely derelict.',True)) story.append(block('Grammar Exercise 8 - Suggested model comments','• My city centre is <b>really, really</b> busy on Saturday afternoons.\n• The news report was <b>absolutely</b> shocking.\n• We had a <b>completely</b> disastrous night out because the train was cancelled.\n• The heatwave was <b>utterly</b> unbearable.\n• I would <b>highly</b> recommend the museum: it is <b>absolutely fantastic</b>.',False)) story.append(block('Developing Conversations Exercise 9 - Answers','1 c 2 f 3 e 4 a 5 b 6 d',True)) story.append(block('Exercises 10-12 - Suggested model','A: Have you been to Barcelona?\nB: Yes. It was like a building site near my hotel.\nA: Really?\nB: Seriously. They were constantly repairing the roads. But the old town was absolutely beautiful.',False)) story.append(PageBreak()) story.append(Paragraph('1B - Urban tales',h)) story.append(block('Speaking Exercises 1-2 - Suggested answers','Answers depend on students’ experiences. An urban legend is a modern story that is passed from person to person as if it were true, often involving danger, crime, a warning or an unexplained event.',False)) story.append(block('Reading Exercise 3 - Answers','1 NG 2 F 3 T 4 T 5 T 6 T 7 NG 8 NG 9 F',True)) story.append(block('Reading Exercises 4-6 - Suggested language','Useful words / phrases: folklore; passed down from generation to generation; word of mouth; urban legend; friend of a friend; misogynistic attitudes; fake news; conspiracy theory; not cut and dried.\nDiscussion answers will vary. Students should support opinions with examples and reasons.',False)) story.append(Paragraph('Vocabulary - Binomials',h)) story.append(block('Exercise 7 - Answers','part and parcel; far and wide; cut and dried; by and large; first and foremost; time and again',True)) story.append(block('Exercise 8 - Answers','checks and balances; here and there; hit and miss; hustle and bustle; law and order; long and hard; out and about; rise and fall; rules and regulations; safe and sound; straight and narrow; to and fro',True)) story.append(block('Exercise 9 - Suggested pronunciation support','Practise the reduced pronunciation of “and” /ən/ in each binomial, for example: checks ’n balances; hustle ’n bustle. Students’ difficult items will vary.',False)) story.append(block('Exercise 10 - Answers','1 By and large\n2 part and parcel\n3 hustle and bustle\n4 here and there\n5 rules and regulations\n6 rise and fall\n7 long and hard\n8 out and about\n9 hit and miss\n10 law and order',True)) story.append(block('Exercises 11-12 - Suggested model response','“By and large, cities can be good places for children if they have safe parks, reliable public transport and affordable housing. However, the hustle and bustle can be stressful.”\nFor Exercise 12, accept any clear retelling of the chosen urban-myth outline, followed by an opinion about its possible moral or truth.',False)) story.append(Spacer(1,10)); story.append(Paragraph('Source note: red answers were transcribed or condensed from the supplied five-page Teacher’s Book extract. Yellow entries are teacher-ready suggested answers for open-ended or unsupplied activities.',small)) class NumCanvas(Canvas): def __init__(self,*a,**kw): Canvas.__init__(self,*a,**kw); self.pages=[] def showPage(self): self.pages.append(dict(self.__dict__)); self._startPage() def save(self): n=len(self.pages) for st in self.pages: self.__dict__.update(st); self.setFont('Helvetica',8); self.setFillColor(colors.HexColor('#666666')); self.drawString(1.7*cm,1.1*cm,'Cities - Unit 1 Teacher’s Answer Book'); self.drawRightString(A4[0]-1.7*cm,1.1*cm,f'Page {self._pageNumber} of {n}'); Canvas.showPage(self) Canvas.save(self) doc=SimpleDocTemplate(str(out),pagesize=A4,rightMargin=1.5*cm,leftMargin=1.5*cm,topMargin=1.4*cm,bottomMargin=1.6*cm,title='Cities Unit 1 Colour-Coded Teacher’s Book',author='Orris') doc.build(story,canvasmaker=NumCanvas) print(out, out.exists(), out.stat().st_size) PY python -c "from pypdf import PdfReader; p='/tmp/workspace/cities-teacher-book/output/Cities_Unit_1_Colour_Coded_Teachers_Book.pdf'; r=PdfReader(p); print('PAGES',len(r.pages)); print(r.pages[0].extract_text()[:500])"
Cities Unit 1 Colour Coded Teachers Book
PDF Document · PDF
Please create following changes in the pdf prepared. Firstly remove <b> symbol and replace it with a blue color underline for answers to identify answers easily. Secondly please write proper complete answers in yellow background with black text for which answers were not mentioned properly in teacher's book.
~/cities-teacher-book
~/cities-teacher-book/output
python - <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak, Flowable from reportlab.pdfgen.canvas import Canvas from pathlib import Path out=Path('/tmp/workspace/cities-teacher-book/output/Cities_Unit_1_Colour_Coded_Teachers_Book_REVISED.pdf') RED=colors.HexColor('#B00020'); YELLOW=colors.HexColor('#FFE566'); NAVY=colors.HexColor('#17365D'); BLUE='#1261C9' styles=getSampleStyleSheet() base=ParagraphStyle('base',parent=styles['BodyText'],fontName='Helvetica',fontSize=9.15,leading=12,spaceAfter=3) title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=21,leading=25,textColor=NAVY,alignment=TA_CENTER,spaceAfter=8) sub=ParagraphStyle('sub',parent=base,fontSize=10,leading=13,alignment=TA_CENTER,textColor=colors.HexColor('#444444')) h=ParagraphStyle('h',parent=styles['Heading2'],fontName='Helvetica-Bold',fontSize=14,leading=17,textColor=NAVY,spaceBefore=10,spaceAfter=5) foot=ParagraphStyle('foot',parent=base,fontSize=8,leading=10,textColor=colors.HexColor('#555555')) def esc(s): return s.replace('&','&').replace('<','<').replace('>','>') class ColorBox(Flowable): def __init__(self,label,lines,supplied): super().__init__(); self.label=label; self.lines=lines; self.supplied=supplied; self.bg=RED if supplied else YELLOW; self.txt=colors.white if supplied else colors.black def wrap(self,w,h): self.width=w; self.ps=[]; total=15 lab=ParagraphStyle('lab',parent=base,fontName='Helvetica-Bold',fontSize=10,leading=13,textColor=self.txt,spaceAfter=4) self.ps.append(Paragraph(esc(self.label),lab)) st=ParagraphStyle('ans',parent=base,fontName='Helvetica',fontSize=9.05,leading=12,textColor=self.txt,spaceAfter=2) for line in self.lines: # Underline is blue only; answer text maintains white/black according to the required colour scheme. rich='<u color="%s">%s</u>'%(BLUE,esc(line).replace('•','•')) self.ps.append(Paragraph(rich,st)) for p in self.ps: _,ph=p.wrap(w-20,h); total+=ph self.height=total; return w,total def draw(self): c=self.canv; c.saveState(); c.setFillColor(self.bg); c.roundRect(0,0,self.width,self.height,7,stroke=0,fill=1); c.restoreState(); y=self.height-8 for p in self.ps: _,ph=p.wrap(self.width-20,self.height); y-=ph; p.drawOn(c,10,y) def box(label,text,sup=True): return ColorBox(label,text if isinstance(text,list) else text.split('\n'),sup) story=[Paragraph('CITIES - UNIT 1',title),Paragraph('Revised Colour-Coded Teacher’s Answer Book | Student’s Book pages 6-11',sub),Spacer(1,10)] story += [box('COLOUR KEY AND ANSWER MARKING',['RED background / white text: answers supplied in the provided Teacher’s Book extract.','YELLOW background / black text: complete teacher-ready suggested answers prepared where no fixed answer was supplied.','Every answer line has a BLUE underline for rapid identification.'],False),Spacer(1,8)] story.append(Paragraph('1A - A real buzz about the place',h)) story.append(box('Speaking 1 - Teacher’s Book example answer',['Positive: affluent / wealthy, charming, clean / spotless, compact, suburban / residential, well-run / organized, peaceful.','Negative: boring / dull, expensive / pricey.'],True)) story.append(box('Speaking 2 - Teacher’s Book example answer',['Advantages: residents may feel safer; the area is attractive; homes appear comfortable.','Drawbacks: the cost of living may be higher and the lifestyle may be slow-paced.'],True)) story.append(box('Speaking 3 - Complete suggested answer',['The place in the photo seems quieter, cleaner and more spacious than where I live. It has low-rise homes, gardens and wide streets, whereas my area has more apartment blocks, traffic and shops. Both places are residential, but this place looks more affluent and peaceful.'],False)) story.append(Paragraph('Vocabulary - City life',h)) story.append(box('Exercise 1 - Complete meaning key',['1 springing up = appearing suddenly; buzz = an exciting, positive atmosphere.','2 grand houses = large, impressive houses; gated apartments = apartment buildings with controlled entry.','3 transport infrastructure = systems such as roads, railways, trams and stations; runs very smoothly = functions efficiently.','4 smog = polluted fog caused by smoke and exhaust; choke on the fumes = find it difficult to breathe because of polluted air.','5 trace = a very small amount; littering = dropping rubbish in public places.','6 grinds to a halt = stops completely; horns = devices in vehicles used to make a warning sound.','7 gentrification = an area becoming improved and more expensive as wealthier people move in; settling down = starting a long-term home life in one place.','8 neglected = not cared for; derelict = abandoned and in a poor condition.','9 residential developments = newly built housing areas; outskirts = the areas at the edge of a city.','10 crammed = packed tightly into a small space; dingy = dark, dirty and unattractive.'],True)) story.append(box('Exercise 2.1-6 - Teacher’s Book example answers',['1 People, vehicles, colours, music, restaurants, cafés, bars and street markets might give a place a buzz.','2 The opposite is when buildings are left to decay, are demolished, or when no new buildings are built.','3 Bridges, water supplies, electricity grids, waste disposal, internet networks and telecommunications are essential infrastructure.','4 A factory, a production process, a business, a machine, a website or a web server might grind to a halt.','5 Signs include renovated homes, new cafés and boutiques, rising rents, better public spaces and wealthier residents moving in. It may happen because the location is attractive and investment is profitable.','6 An area may become neglected when public spending falls, businesses leave or owners cannot afford repairs. Signs include litter, graffiti, broken signs, empty shops, peeling paint and damaged roads.'],True)) story.append(box('Exercise 2.7 - Teacher’s Book answers',['1 up-and-coming, vibrant. 2 affluent. 3 well-run. 4 polluted. 5 spotless, well-run. 6 chaotic, congested. 7 up-and-coming. 8 run-down. 9 sprawling. 10 deprived, congested.'],True)) story.append(PageBreak()) story.append(Paragraph('1A - Listening, grammar and speaking',h)) story.append(box('Listening Exercise 3 - Teacher’s Book answers',['Conversation 1 - Positive: the nightlife is crazy; the whole city is still buzzing at four in the morning; downtown is very vibrant. Negative: the traffic is terrible; it is very humid and hard to walk around; it is very polluted.','Conversation 2 - Positive: affluent; a good place to bring up children; clean; everything runs smoothly. Negative: conservative and affluent; dull; not much going on; no music scene.'],True)) story.append(box('Listening Exercise 4 - Complete suggested answer',['1 Conversation 1 could describe Bangkok because it has a vibrant nightlife, neon lights, heavy traffic, humidity and serious smog. Conversation 2 could describe an affluent commuter town because it is clean, safe and efficient but dull and conservative.','2 I would rather live in the second place if I had children because it is clean, safe and well-run. At this stage of life, however, I might prefer the first place because it is more vibrant and has a better nightlife and music scene.'],False)) story.append(box('Listening Exercise 5 - Teacher’s Book answers',['1 took me by surprise. 2 in the early hours. 3 might as well. 4 it’s like hitting. 5 have its drawbacks.','6 that sort of place. 7 more of a music scene. 8 consider going back. 9 get me wrong. 10 were to settle down.'],True)) story.append(box('Speaking Exercise 6 - Complete model responses',['1 “Tokyo took me by surprise because it was much more organized and crowded than I expected.”','2 “I once stayed out until the early hours after a concert. We missed the last train and had to take a taxi home.”','3 “The main drawbacks where I live are traffic congestion, expensive housing and a lack of green spaces.”','4 “There is a café scene, a live-music scene and a growing food-market scene in my city.”','5 “A good place to settle down in my region is a small town outside the city because housing is cheaper, it is peaceful and the train connection is reliable.”'],False)) story.append(box('Grammar Exercise 7 - Teacher’s Book corrections',['1 There are some very / really fancy shops around there, despite the crumbling buildings.','2 There was just a real buzz about the place and we had an absolute whale of a time.','3 Correct: It was just a simply amazing thing to experience - an absolute dream come true.','4 The area is incredibly quiet and the streets are absolutely / completely / utterly / really deserted at night.','5 It was really, really run-down, with some buildings just completely derelict.'],True)) story.append(box('Grammar Exercise 8 - Complete sample answers',['City / area: “The old town is really, really lively at weekends, but the narrow streets become completely packed.”','News: “The report about the flooding was absolutely shocking and the damage was total.”','Night out: “We had an absolutely fantastic meal, but the club was completely empty.”','Something that went wrong: “The flight cancellation was a complete and utter nightmare.”','Weather: “The heat was utterly unbearable, so we stayed indoors all afternoon.”','Recommendation: “I would strongly recommend the museum because the exhibition is absolutely amazing.”'],False)) story.append(box('Developing Conversations Exercise 9 - Teacher’s Book answers',['1 c. 2 f. 3 e. 4 a. 5 b. 6 d.'],True)) story.append(box('Exercises 10-12 - Complete model dialogue',['A: Have you been to Barcelona?','B: Yes. The old town was absolutely beautiful, but the area near our hotel was like a building site.','A: Really?','B: Seriously. They were constantly repairing the roads and crumbling buildings. Still, the restaurants treated us like royalty.'],False)) story.append(PageBreak()) story.append(Paragraph('1B - Urban tales',h)) story.append(box('Speaking Exercises 1-2 - Complete suggested answers',['1 “There is an old bridge in my town that people say is haunted. The legend says that a traveller appears there after midnight.”','2 “I was read Cinderella and Aladdin as a child. I liked them because the stories were exciting and usually ended happily.”','3 Legends often teach children not to lie, to be kind, to be brave and not to trust strangers. These lessons are still useful, although modern children should also learn to question stereotypes in old stories.','4 An urban legend is a modern story passed from person to person as if it were true. It usually happens to a ‘friend of a friend’ and often includes danger, crime, a warning or something strange.”'],False)) story.append(box('Reading Exercise 3 - Teacher’s Book answers',['1 NG. 2 F. 3 T. 4 T. 5 T. 6 T. 7 NG. 8 NG. 9 F.'],True)) story.append(box('Reading Exercises 4-6 - Complete answer support',['Exercise 4 useful language: folklore; passed on from generation to generation; word of mouth; urban legend; friend of a friend; contemporary society; conspiracy theory; fake news; not cut and dried.','Exercise 6, set 1: “Folklore is worth studying because it reveals what communities fear, value and remember. I would pass on a local story because it connects children with their area.”','Set 2: “Urban myths often warn people about strangers, unsafe places or new technology. They reflect modern anxieties about crime, travel and social media.”','Set 3: “There is an empty factory near my area. It is privately owned and may be redeveloped into flats. People say it is haunted, but there is no evidence.”','Set 4: “Rumours and fake news spread faster now because social media allows people to share unverified claims immediately. Checking the source and date helps prevent misinformation.”'],False)) story.append(Paragraph('Vocabulary - Binomials',h)) story.append(box('Exercise 7 - Teacher’s Book answers',['part and parcel; far and wide; cut and dried; by and large; first and foremost; time and again.'],True)) story.append(box('Exercise 8 - Teacher’s Book answers',['checks and balances; here and there; hit and miss; hustle and bustle; law and order; long and hard; out and about; rise and fall; rules and regulations; safe and sound; straight and narrow; to and fro.'],True)) story.append(box('Exercise 9 - Complete pronunciation support',['Say and as the weak sound /ən/: checks ’n balances; hustle ’n bustle; law ’n order. Stress the first main word in each pair: HUS-tle and BUS-tle; SAFE and SOUND; LONG and HARD.'],False)) story.append(box('Exercise 10 - Teacher’s Book answers',['1 By and large. 2 part and parcel. 3 hustle and bustle. 4 here and there. 5 rules and regulations.','6 rise and fall. 7 long and hard. 8 out and about. 9 hit and miss. 10 law and order.'],True)) story.append(box('Exercises 11-12 - Complete suggested response',['“By and large, cities can be good places for children if they have safe parks, reliable public transport, good schools and affordable housing. However, the hustle and bustle can be stressful and traffic can be dangerous.”','For Exercise 12, a complete urban-legend retelling should include: who it happened to, where and when it happened, the unusual or frightening event, the ending, and the moral. Example moral: “Do not accept information without checking whether it is true.”'],False)) story += [Spacer(1,8),Paragraph('Source note: Red boxes reproduce or closely condense supplied Teacher’s Book answers. Yellow boxes provide complete teacher-ready model answers for activities without a fixed answer in the supplied extract.',foot)] class Numbered(Canvas): def __init__(self,*a,**k): Canvas.__init__(self,*a,**k); self.states=[] def showPage(self): self.states.append(dict(self.__dict__)); self._startPage() def save(self): total=len(self.states) for s in self.states: self.__dict__.update(s); self.setFont('Helvetica',8); self.setFillColor(colors.HexColor('#555555')); self.drawString(1.5*cm,1.0*cm,'Cities - Unit 1 Revised Teacher’s Answer Book'); self.drawRightString(A4[0]-1.5*cm,1.0*cm,f'Page {self._pageNumber} of {total}'); Canvas.showPage(self) Canvas.save(self) doc=SimpleDocTemplate(str(out),pagesize=A4,leftMargin=1.45*cm,rightMargin=1.45*cm,topMargin=1.35*cm,bottomMargin=1.45*cm,title='Cities Unit 1 Revised Colour-Coded Teacher’s Book') doc.build(story,canvasmaker=Numbered) print(out, out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/cities-teacher-book/output/Cities_Unit_1_Colour_Coded_Teachers_Book_REVISED.pdf' r=PdfReader(p) t=''.join(page.extract_text() or '' for page in r.pages) print('pages=',len(r.pages),'chars=',len(t),'literal_b=', '<b>' in t, 'contains_underlined_answer=', 'took me by surprise' in t) PY
<b> symbols.Cities Unit 1 Colour Coded Teachers Book REVISED
PDF Document · PDF
You much separately put individual answers for questions 10,11,12 from unit 1A
python - <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Flowable from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from pypdf import PdfReader, PdfWriter from pathlib import Path root=Path('/tmp/workspace/cities-teacher-book/output') base_pdf=root/'Cities_Unit_1_Colour_Coded_Teachers_Book_REVISED.pdf' page_pdf=root/'unit_1A_exercises_10_12_page.pdf' out=root/'Cities_Unit_1_Colour_Coded_Teachers_Book_FINAL.pdf' BLUE='#1261C9'; YELLOW=colors.HexColor('#FFE566'); NAVY=colors.HexColor('#17365D') styles=getSampleStyleSheet() title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=18,leading=22,textColor=NAVY,alignment=TA_CENTER,spaceAfter=8) sub=ParagraphStyle('sub',parent=styles['BodyText'],fontName='Helvetica',fontSize=10,leading=13,alignment=TA_CENTER,textColor=colors.HexColor('#444444'),spaceAfter=12) class Box(Flowable): def __init__(self,heading,lines): super().__init__(); self.heading=heading; self.lines=lines def wrap(self,w,h): self.w=w; self.parts=[]; total=16 hs=ParagraphStyle('head',fontName='Helvetica-Bold',fontSize=11,leading=14,textColor=colors.black,spaceAfter=5) ps=ParagraphStyle('answer',fontName='Helvetica',fontSize=10,leading=14,textColor=colors.black,spaceAfter=4) self.parts.append(Paragraph(self.heading,hs)) for x in self.lines: self.parts.append(Paragraph('<u color="%s">%s</u>'%(BLUE,x.replace('&','&')),ps)) for p in self.parts: _,ph=p.wrap(w-24,h); total+=ph self.h=total; return w,total def draw(self): c=self.canv; c.saveState(); c.setFillColor(YELLOW); c.roundRect(0,0,self.w,self.h,8,fill=1,stroke=0); c.restoreState(); y=self.h-9 for p in self.parts: _,ph=p.wrap(self.w-24,self.h); y-=ph; p.drawOn(c,12,y) story=[Paragraph('UNIT 1A - INDIVIDUAL ANSWERS',title),Paragraph('Exercises 10, 11 and 12 | Yellow = complete suggested answers',sub)] story += [Box('Exercise 10 - Use the sentences and examples in Exercise 9 to have conversations.',[ '1. A: It’s like Beverly Hills round there. B: Really? A: Seriously. It’s all massive gated mansions with fancy cars parked outside.', '2. A: The place is like a building site. B: Is it? A: Honestly, they’re constantly repairing the roads and crumbling buildings.', '3. A: They treated us like royalty. B: Really? A: Absolutely. They provided an incredible five-course dinner.', '4. A: They treat the road like a race track. B: That sounds dangerous. A: Literally. They drive along there at 100 miles an hour.', '5. A: It was like talking to a brick wall. B: What happened? A: They just refused to do anything whatsoever to help.', '6. A: It was like a fridge in there. B: Was the heating broken? A: No. The air conditioning was so high that I had to put my coat on.' ]),Spacer(1,10),Box('Exercise 11 - Write the names of two cities you have been to. Make notes about aspects of the cities and one thing that happened to you in each city.',[ 'City 1: Bangkok. Notes: vibrant nightlife, excellent street food, heavy traffic, humid weather and pollution. Experience: I got caught in a sudden rainstorm and took a river boat back to my hotel.', 'City 2: Barcelona. Notes: beautiful architecture, lively beaches, busy tourist areas, good public transport and expensive restaurants near the centre. Experience: I visited the Sagrada Família early in the morning and avoided the longest queues.' ]),Spacer(1,10),Box('Exercise 12 - Have conversations about your chosen cities.',[ 'A: Have you been to Bangkok? B: Yes, I went last year. It really took me by surprise because it was so vibrant, even late at night. A: Really? What did you like most? B: The street food and the energy of the city. The traffic was terrible, though, and the heat was absolutely exhausting.', 'A: Have you been to Barcelona? B: Yes. It was absolutely beautiful, especially the old streets and the Sagrada Família. A: Was it expensive? B: The city centre was quite pricey, but the metro ran very smoothly. I would definitely recommend it.' ])] doc=SimpleDocTemplate(str(page_pdf),pagesize=A4,leftMargin=1.5*cm,rightMargin=1.5*cm,topMargin=1.4*cm,bottomMargin=1.4*cm) doc.build(story) writer=PdfWriter() for pg in PdfReader(str(base_pdf)).pages: writer.add_page(pg) for pg in PdfReader(str(page_pdf)).pages: writer.add_page(pg) with open(out,'wb') as f: writer.write(f) print(out, out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/cities-teacher-book/output/Cities_Unit_1_Colour_Coded_Teachers_Book_FINAL.pdf' r=PdfReader(p) t=r.pages[-1].extract_text() or '' print('pages',len(r.pages),'lastpage',t[:700]) assert 'Exercise 10' in t and 'Exercise 11' in t and 'Exercise 12' in t PY
Cities Unit 1 Colour Coded Teachers Book FINAL
PDF Document · PDF
Use the following information from the photo and create a pdf in which showing different types of houses with photos and type of house under every photo .Also don't forget to remove electronic stamp from there photos
Create a clean photorealistic contact sheet with 28 separate, clearly divided house photographs in a 4-column by 7-row grid. No text, numbers, logos, stamps, labels, watermarks, or borders. Each cell must show exactly one distinct housing type in this order from left to right, top to bottom: tree house, igloo, apartment building, bungalow, caravan, castle, condominium, cottage, dormitory, duplex, farmhouse, hotel, houseboat, hut, lighthouse, log cabin, manor, motel, palace, shack, skyscraper, container house, tent, stilt house, single-family detached home, semi-detached house, mansion, villa. Wide enough space around each house, realistic daylight photography, each housing type visually unmistakable.
~/
mkdir -p "/tmp/workspace/house-types-pdf/assets" "/tmp/workspace/house-types-pdf/output" && curl -L "https://cdn.orris.care/image-gen/e0fc0c97b2f54124871c93dd1d7a5425.png" -o "/tmp/workspace/house-types-pdf/assets/houses_contact_sheet.png" && python - <<'PY' from PIL import Image p='/tmp/workspace/house-types-pdf/assets/houses_contact_sheet.png' im=Image.open(p) print(im.size, im.mode) PY
python - <<'PY' from PIL import Image im=Image.open('/tmp/workspace/house-types-pdf/assets/houses_contact_sheet.png') im.thumbnail((700,700)) im.save('/tmp/workspace/house-types-pdf/assets/preview.jpg',quality=72,optimize=True) print(im.size) PY
python - <<'PY' from PIL import Image, ImageOps from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Image as RLImage, Paragraph, Spacer, PageBreak from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from pathlib import Path root=Path('/tmp/workspace/house-types-pdf') assets=root/'assets'; out=root/'output'/'Types_of_Houses_Watermark_Free.pdf' sheet=Image.open(assets/'houses_contact_sheet.png').convert('RGB') W,H=sheet.size names=['Tree House','Igloo','Apartment','Bungalow','Caravan','Castle','Condominium','Cottage','Dormitory','Duplex','Farmhouse','Hotel','Houseboat','Hut','Lighthouse','Log Cabin','Manor','Motel','Palace','Shack','Skyscraper','Container House','Tent','Stilt House','Single-Family Detached Home','Semi-Detached House','Mansion','Villa'] # Crop 4x7 visual cells, with minor padding to avoid cross-cell blending files=[] for r in range(7): for c in range(4): idx=r*4+c x0=round(c*W/4); x1=round((c+1)*W/4); y0=round(r*H/7); y1=round((r+1)*H/7) pad=5 crop=sheet.crop((x0+pad,y0+pad,x1-pad,y1-pad)) # fixed visual image at consistent quality fn=assets/f'house_{idx+1:02d}.jpg'; crop.save(fn,quality=92) files.append(fn) styles=getSampleStyleSheet() title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=22,leading=27,textColor=colors.HexColor('#174F38'),alignment=TA_CENTER,spaceAfter=4) sub=ParagraphStyle('sub',parent=styles['BodyText'],fontSize=10,leading=13,alignment=TA_CENTER,textColor=colors.HexColor('#4C4C4C'),spaceAfter=10) lab=ParagraphStyle('lab',parent=styles['BodyText'],fontName='Helvetica-Bold',fontSize=12,leading=15,alignment=TA_CENTER,textColor=colors.HexColor('#123B2A'),spaceBefore=4,spaceAfter=4) story=[] for p in range(7): story += [Paragraph('TYPES OF HOUSES',title),Paragraph('House pictures and names',sub)] row=[] for i in range(p*4,p*4+4): img=RLImage(str(files[i]),width=4.35*cm,height=5.0*cm,kind='proportional') # place the image, then below photo type name row.append([img,Paragraph(names[i],lab)]) t=Table([row],colWidths=[4.6*cm]*4,rowHeights=[None]) t.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),'TOP'),('ALIGN',(0,0),(-1,-1),'CENTER'),('LEFTPADDING',(0,0),(-1,-1),3),('RIGHTPADDING',(0,0),(-1,-1),3),('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),6),('BACKGROUND',(0,0),(-1,-1),colors.HexColor('#F8FBF6')),('BOX',(0,0),(-1,-1),0.6,colors.HexColor('#B5CBB9')),('INNERGRID',(0,0),(-1,-1),0.6,colors.HexColor('#B5CBB9'))])) story.append(t) story.append(Spacer(1,1.2*cm)) if p<6: story.append(PageBreak()) def footer(c,doc): c.saveState(); c.setStrokeColor(colors.HexColor('#174F38')); c.setLineWidth(.5); c.line(1.5*cm,1.25*cm,A4[0]-1.5*cm,1.25*cm); c.setFont('Helvetica',8); c.setFillColor(colors.HexColor('#555555')); c.drawCentredString(A4[0]/2,0.8*cm,f'Types of Houses | Page {doc.page}'); c.restoreState() doc=SimpleDocTemplate(str(out),pagesize=A4,leftMargin=1.2*cm,rightMargin=1.2*cm,topMargin=1.15*cm,bottomMargin=1.5*cm,title='Types of Houses') doc.build(story,onFirstPage=footer,onLaterPages=footer) print(out,out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/house-types-pdf/output/Types_of_Houses_Watermark_Free.pdf' r=PdfReader(p); text='\n'.join(x.extract_text() or '' for x in r.pages) print('pages',len(r.pages),'tree', 'Tree House' in text,'villa','Villa' in text,'stamp?', 'test-english' in text.lower()) PY
Types of Houses Watermark Free
PDF Document · PDF
The photos are cut from down half in pdf and complete photo is not visible with labelling.Pleseeccorrect it.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: tree house, igloo, apartment building, bungalow. Full house visible in each panel, daylight photography.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: caravan, castle, condominium, cottage. Full house visible in each panel, daylight photography.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: dormitory building, duplex house, farmhouse, hotel building. Full building visible in each panel, daylight photography.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: houseboat, traditional hut, lighthouse, log cabin. Full building visible in each panel, daylight photography.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: manor house, roadside motel, palace, wooden shack. Full building visible in each panel, daylight photography.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: skyscraper, container house, camping tent, stilt house. Full building visible in each panel, daylight photography.
Create a clean photorealistic four-panel horizontal contact sheet. No text, labels, numbers, logos, watermarks, stamps, borders, or cropped objects. Exactly four equally sized square panels, each with one complete house and ample space around it. From left to right: single-family detached home, semi-detached house, mansion, villa. Full building visible in each panel, daylight photography.
python - <<'PY' import urllib.request from pathlib import Path urls=['https://cdn.orris.care/image-gen/1168c5c95e0346eea7d16595ce83210c.png','https://cdn.orris.care/image-gen/980d7cf15e5e40319f1391121d9cebf0.png','https://cdn.orris.care/image-gen/d0b249c1d58c452ba2613622688509bb.png','https://cdn.orris.care/image-gen/59566732521d4706bb9150ec0fddee08.png','https://cdn.orris.care/image-gen/54073914779b4097b36df554e1fbdcc2.png','https://cdn.orris.care/image-gen/78881921bea847c4be5e5c4a663e5666.png','https://cdn.orris.care/image-gen/db99181c95aa48779633aad4512fec66.png'] out=Path('/tmp/workspace/house-types-pdf/assets/corrected'); out.mkdir(parents=True,exist_ok=True) for i,u in enumerate(urls,1): p=out/f'row_{i}.png'; urllib.request.urlretrieve(u,p); print(i,p.stat().st_size) PY python - <<'PY' from PIL import Image from pathlib import Path for p in sorted(Path('/tmp/workspace/house-types-pdf/assets/corrected').glob('*.png')): print(p.name,Image.open(p).size) PY
python - <<'PY' from PIL import Image from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Image as RLImage, Paragraph, Spacer, PageBreak from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from pathlib import Path root=Path('/tmp/workspace/house-types-pdf') assets=root/'assets'/'corrected'; crops=root/'assets'/'corrected_crops'; crops.mkdir(exist_ok=True) out=root/'output'/'Types_of_Houses_COMPLETE_PHOTOS.pdf' names=['Tree House','Igloo','Apartment','Bungalow','Caravan','Castle','Condominium','Cottage','Dormitory','Duplex','Farmhouse','Hotel','Houseboat','Hut','Lighthouse','Log Cabin','Manor','Motel','Palace','Shack','Skyscraper','Container House','Tent','Stilt House','Single-Family Detached Home','Semi-Detached House','Mansion','Villa'] files=[] for r in range(7): im=Image.open(assets/f'row_{r+1}.png').convert('RGB') W,H=im.size for c in range(4): # Exact full-height panel crop, no removal from top or bottom x0=round(c*W/4); x1=round((c+1)*W/4) crop=im.crop((x0,0,x1,H)) p=crops/f'house_{r*4+c+1:02d}.jpg'; crop.save(p,quality=95,subsampling=0); files.append(p) styles=getSampleStyleSheet() title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=23,leading=27,textColor=colors.HexColor('#174F38'),alignment=TA_CENTER,spaceAfter=4) sub=ParagraphStyle('sub',parent=styles['BodyText'],fontName='Helvetica',fontSize=10,leading=13,alignment=TA_CENTER,textColor=colors.HexColor('#4A4A4A'),spaceAfter=11) lab=ParagraphStyle('lab',parent=styles['BodyText'],fontName='Helvetica-Bold',fontSize=11,leading=13,alignment=TA_CENTER,textColor=colors.HexColor('#123B2A'),spaceBefore=5,spaceAfter=4) story=[] for p in range(7): story.extend([Paragraph('TYPES OF HOUSES',title),Paragraph('Complete house photograph with the house type below',sub)]) cells=[] for i in range(p*4,p*4+4): # preserve original aspect ratio. Full image receives height available on page and will not be clipped. img=RLImage(str(files[i]),width=4.25*cm,height=8.7*cm,kind='proportional') cells.append([img,Paragraph(names[i],lab)]) table=Table([cells],colWidths=[4.45*cm]*4) table.setStyle(TableStyle([('VALIGN',(0,0),(-1,-1),'TOP'),('ALIGN',(0,0),(-1,-1),'CENTER'),('BACKGROUND',(0,0),(-1,-1),colors.HexColor('#F8FBF6')),('BOX',(0,0),(-1,-1),0.7,colors.HexColor('#8EB49A')),('INNERGRID',(0,0),(-1,-1),0.7,colors.HexColor('#8EB49A')),('LEFTPADDING',(0,0),(-1,-1),2),('RIGHTPADDING',(0,0),(-1,-1),2),('TOPPADDING',(0,0),(-1,-1),6),('BOTTOMPADDING',(0,0),(-1,-1),6)])) story += [table,Spacer(1,1.5*cm)] if p<6: story.append(PageBreak()) def footer(c,doc): c.saveState(); c.setStrokeColor(colors.HexColor('#174F38')); c.line(1.5*cm,1.25*cm,A4[0]-1.5*cm,1.25*cm); c.setFont('Helvetica',8);c.setFillColor(colors.HexColor('#555555')); c.drawCentredString(A4[0]/2,.8*cm,f'Types of Houses | Page {doc.page}'); c.restoreState() doc=SimpleDocTemplate(str(out),pagesize=A4,leftMargin=1.2*cm,rightMargin=1.2*cm,topMargin=1.1*cm,bottomMargin=1.5*cm,title='Types of Houses - Complete Photos') doc.build(story,onFirstPage=footer,onLaterPages=footer) print(out,out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/house-types-pdf/output/Types_of_Houses_COMPLETE_PHOTOS.pdf' r=PdfReader(p); text=' '.join(pg.extract_text() or '' for pg in r.pages) print('Pages',len(r.pages),'All labels',all(s in text for s in ['Tree House','Villa','Semi-Detached House','Container House'])) PY
Types of Houses COMPLETE PHOTOS
PDF Document · PDF
Please create a new teacher's book with all the answers in it from student's textbbook exercises,the teacher's book has got 4 pages pdf for you to understand and differentiate between student's book and teacher's book,also please create red background and white text for proper full answers already give in teacher's book from student's book and yellow background with black text in it for answers not given in teacher's book and you have to create it for me from exercises of student's book. Please write proper complete answers individually for those given in teacher's book.
~/attachments/99393f7c-9856-4e70-91c0-8253521e8a16
mkdir -p "/tmp/workspace/new-teacher-book/src" "/tmp/workspace/new-teacher-book/output" && python - <<'PY' from pypdf import PdfReader from pathlib import Path root=Path('/tmp/workspace/attachments/99393f7c-9856-4e70-91c0-8253521e8a16') out=Path('/tmp/workspace/new-teacher-book/src') for n in ['DOC-20260829-WA0033.pdf','DOC-20260829-WA0034.pdf']: r=PdfReader(str(root/n)); text=''.join(f'\n\n===== PAGE {i+1} =====\n'+(p.extract_text() or '') for i,p in enumerate(r.pages)); (out/(n+'.txt')).write_text(text); print('\n###',n,'PAGES',len(r.pages)); print(text[:18000]) PY
python - <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak, Flowable from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.pdfgen.canvas import Canvas from pathlib import Path out=Path('/tmp/workspace/new-teacher-book/output/Urban_Tales_1B_Colour_Coded_Teachers_Book.pdf') RED=colors.HexColor('#B00020'); YELLOW=colors.HexColor('#FFE566'); NAVY=colors.HexColor('#17365D') styles=getSampleStyleSheet() title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=21,leading=25,textColor=NAVY,alignment=TA_CENTER,spaceAfter=6) subtitle=ParagraphStyle('sub',parent=styles['BodyText'],fontName='Helvetica',fontSize=10,leading=13,alignment=TA_CENTER,textColor=colors.HexColor('#444444'),spaceAfter=11) heading=ParagraphStyle('heading',parent=styles['Heading2'],fontName='Helvetica-Bold',fontSize=14,leading=17,textColor=NAVY,spaceBefore=8,spaceAfter=5) note=ParagraphStyle('note',parent=styles['BodyText'],fontName='Helvetica',fontSize=8,leading=10,textColor=colors.HexColor('#555555')) def esc(s): return s.replace('&','&').replace('<','<').replace('>','>') class Box(Flowable): def __init__(self,label,lines,sup): super().__init__(); self.label=label; self.lines=lines; self.sup=sup def wrap(self,w,h): self.w=w; self.bg=RED if self.sup else YELLOW; tc=colors.white if self.sup else colors.black; self.ps=[]; total=15 self.ps.append(Paragraph(esc(self.label),ParagraphStyle('lab',fontName='Helvetica-Bold',fontSize=10.5,leading=13,textColor=tc,spaceAfter=4))) s=ParagraphStyle('content',fontName='Helvetica',fontSize=8.85,leading=11.4,textColor=tc,spaceAfter=2.5) for x in self.lines: self.ps.append(Paragraph(esc(x).replace('•','•'),s)) for p in self.ps: _,ph=p.wrap(w-20,h); total+=ph self.h=total; return w,total def draw(self): c=self.canv;c.saveState();c.setFillColor(self.bg);c.roundRect(0,0,self.w,self.h,7,fill=1,stroke=0);c.restoreState(); y=self.h-8 for p in self.ps: _,ph=p.wrap(self.w-20,self.h);y-=ph;p.drawOn(c,10,y) def b(label,lines,sup): return Box(label,lines if isinstance(lines,list) else lines.split('\n'),sup) story=[Paragraph('URBAN TALES - UNIT 1B',title),Paragraph('Colour-Coded Teacher’s Answer Book | Student’s Book pages 10-11',subtitle)] story += [b('COLOUR KEY',['RED background with white text: supplied Teacher’s Book answer.','YELLOW background with black text: complete suggested answer for an open or unsupplied task.'],False),Spacer(1,6)] story.append(Paragraph('Speaking and reading',heading)) story.append(b('Exercise 1 - Complete individual suggested answers',['1. Yes. There is an old bridge near my town that is connected to a local legend. People say that a traveller who disappeared there appears on foggy nights.','2. I was read Cinderella, Aladdin and Hansel and Gretel when I was young. I liked them because they were imaginative, exciting and usually had a clear ending.','3. Fairy tales often teach children to be honest, kind, brave and careful about strangers. These are still useful lessons, although modern children should also question unfair stereotypes in old stories.','4. An urban legend is a modern story passed from person to person as if it were true. It often happens to a “friend of a friend” and usually involves danger, crime or something strange. An example is the story about alligators living in city sewers.'],False)) story.append(b('Exercise 2 - Complete suggested answer',['The extract partly matches my ideas. I knew that urban legends are modern stories that people repeat as true. New information for me is that they are similar to older fairy tales because they have fixed plots, frightening events and reveal social fears.'],False)) story.append(b('Exercise 3 - Individual Teacher’s Book answers',['1. NG - The text says Jan Brunvand popularized the term, but it does not say that he was the first person to talk about urban legends.','2. F - The Brothers Grimm collected fairy tales and myths; they did not start folklore studies.','3. T - Brunvand argued that urban legends function like modern fairy tales, not simply as entertainment.','4. T - Brunvand asked his students to contribute stories they had heard or seen reported in the media.','5. T - The text gives examples involving crime, injury, death, violence and horror.','6. T - Tellers often add realistic details, including setting events in a real city.','7. NG - The text mentions misogynistic attitudes in older societies but makes no direct claim that modern society is not misogynistic.','8. NG - The text explains similarities between urban myths, rumours and fake news, but does not state that they are becoming more widespread.','9. F - The text says the boundaries between urban myths and rumours are not cut and dried.'],True)) story.append(PageBreak()) story.append(Paragraph('Reading and discussion',heading)) story.append(b('Exercise 4 - Six useful words / phrases',['1. folklore - traditions and stories passed from generation to generation.','2. word of mouth - information shared by people speaking to each other.','3. urban legend - a modern fictional story told as if it were true.','4. air of authenticity - an appearance of being real or genuine.','5. misogynistic attitudes - beliefs or behaviour that show prejudice against women.','6. not cut and dried - not clear, simple or easy to define.'],False)) story.append(b('Exercise 5 - Group answer: six most useful items',['A suitable agreed class list is: folklore; word of mouth; urban legend; friend of a friend; air of authenticity; not cut and dried.'],False)) story.append(b('Exercise 6.1 - Complete suggested answer',['Yes, folklore is worth studying because it shows what a community fears, values and remembers. It also helps us understand how people explained the world before modern science and media. I would pass on a local story about an important place in my area so that younger people remain connected to its history.'],False)) story.append(b('Exercise 6.2 - Complete suggested answer',['Yes. I have heard stories about strangers hiding in cars, dangerous food in restaurants and animals living in sewers. These myths often warn people to be careful, but they also reflect modern fears about crime, travel, food safety and unfamiliar people.'],False)) story.append(b('Exercise 6.3 - Complete suggested answer',['There is an old, derelict warehouse near my area. It is owned by a private company and may eventually be demolished and replaced with flats. Local people say it is haunted because lights are sometimes seen inside at night, although there is no reliable evidence.'],False)) story.append(b('Exercise 6.4 - Complete suggested answer',['Rumours, conspiracy theories and fake news may seem more common because social media allows people to share information immediately. A recent common type of rumour concerns false health advice or misleading stories about local crime. We should check the original source, date and evidence before sharing a claim.'],False)) story.append(PageBreak()) story.append(Paragraph('Vocabulary - Binomials',heading)) story.append(b('Exercise 7 - Individual Teacher’s Book answers',['1. part and parcel = an essential part of something.','2. far and wide = over a large area.','3. cut and dried = clear and easy to understand.','4. by and large = generally.','5. first and foremost = mainly; more than anything else.','6. time and again = often; repeatedly.'],True)) story.append(b('Exercise 8 - Individual Teacher’s Book answers',['1. checks and balances = rules that prevent one person or group from having too much power.','2. here and there = in different places.','3. hit and miss = not carefully planned and therefore inconsistent.','4. hustle and bustle = a lot of busy activity and noise.','5. law and order = respect for laws and the authorities.','6. long and hard = very carefully, as in “think long and hard”.','7. out and about = active and doing normal activities outside home.','8. rise and fall = the growth and decline of something.','9. rules and regulations = official guidelines controlling behaviour or procedures.','10. safe and sound = alive, well and unharmed after danger.','11. straight and narrow = morally correct behaviour.','12. to and fro = backwards and forwards between two places.'],True)) story.append(b('Exercise 9 - Complete suggested pronunciation answer',['The binomials are: by and large; checks and balances; cut and dried; far and wide; first and foremost; here and there; hit and miss; hustle and bustle; law and order; long and hard; out and about; part and parcel; rise and fall; rules and regulations; safe and sound; straight and narrow; to and fro. In natural speech, and is often weak: /ən/.'],False)) story.append(b('Exercise 10 - Individual Teacher’s Book answers',['1. By and large, cities should be good places for children.','2. A certain amount of crime is just part and parcel of life in the city, I’m afraid. It’s unavoidable.','3. It can be quite hard to get away from the hustle and bustle in the city and find some peace and quiet.','4. Our capital is very affluent and only has small pockets of poverty here and there.','5. We should keep rules and regulations around planning and life in the city to a minimum.','6. The fortunes of different cities naturally rise and fall.','7. Anyone thinking about moving out of a city should think long and hard because it will be impossible to move back.','8. When you’re out and about in the city, you’ll see a lot of homeless people begging.','9. There are plenty of places to eat in the city, but the quality is very hit and miss.','10. There has been a breakdown in law and order in some cities and crime is out of control.'],True)) story.append(PageBreak()) story.append(Paragraph('Discussion and urban-legend speaking',heading)) story.append(b('Exercise 11.1 - Complete suggested answer',['By and large, cities can be good places for children if they provide safe parks, reliable transport, good schools and affordable housing. However, this is not true in every city because traffic, pollution and high living costs can make city life difficult for families.'],False)) story.append(b('Exercise 11.2 - Complete suggested answer',['A certain amount of crime may occur in any large city, but it should not be accepted as unavoidable. Better education, employment opportunities, community support and fair policing can reduce crime.'],False)) story.append(b('Exercise 11.3-11.10 - Complete suggested answers',['3. I agree that the hustle and bustle can be tiring, so access to parks and quiet public spaces is important.','4. I agree that affluent capitals often have poverty here and there, but governments should reduce these inequalities.','5. I partly disagree. Sensible rules and regulations are needed to protect residents, buildings and the environment.','6. I agree. Cities can rise and fall as industries change, populations move and new investment arrives.','7. I agree. Moving away may make it difficult to return if house prices rise quickly.','8. I agree that homelessness is visible when people are out and about, but cities should provide housing and support instead of ignoring it.','9. I agree. The quality of restaurants can be hit and miss, so reviews and local recommendations are useful.','10. I partly disagree. Where law and order is weak, crime may increase, but most cities still have many safe areas and law-abiding residents.'],False)) story.append(b('Exercise 12 - Complete individual model urban legend',['Title: The Babysitter. A babysitter was looking after two children while their parents were out. She received several phone calls telling her to “check the children”. At first she ignored them, but she became frightened and called the police. The police traced the calls and discovered that they were coming from inside the same house. The moral is that people should take repeated warnings seriously and ask for help when they feel unsafe.','Title: The Jogger’s Wallet. A man saw someone running away with a wallet and chased the person until he recovered it. Later, he discovered that his own wallet was safely at home, so he had chased an innocent person. The moral is that we should check the facts before making accusations.','Title: Alligators in the Sewers. Workers repairing city sewers discover wild alligators living underground. The story is frightening because it turns an ordinary city system into a dangerous hidden world. The moral is that rumours can grow when people are afraid of places they cannot see or understand.'],False)) story.append(Spacer(1,8));story.append(Paragraph('Source note: Red answer boxes contain supplied Teacher’s Book answers, expanded into clear individual responses where appropriate. Yellow boxes are complete suggested answers for exercises without a fixed answer.',note)) class Numbered(Canvas): def __init__(self,*a,**k):Canvas.__init__(self,*a,**k);self.states=[] def showPage(self):self.states.append(dict(self.__dict__));self._startPage() def save(self): n=len(self.states) for st in self.states: self.__dict__.update(st);self.setFont('Helvetica',8);self.setFillColor(colors.HexColor('#555555'));self.drawString(1.5*cm,1*cm,'Urban Tales - Unit 1B Teacher’s Answer Book');self.drawRightString(A4[0]-1.5*cm,1*cm,f'Page {self._pageNumber} of {n}');Canvas.showPage(self) Canvas.save(self) doc=SimpleDocTemplate(str(out),pagesize=A4,leftMargin=1.4*cm,rightMargin=1.4*cm,topMargin=1.3*cm,bottomMargin=1.5*cm,title='Urban Tales Unit 1B Colour-Coded Teacher’s Book') doc.build(story,canvasmaker=Numbered) print(out,out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/new-teacher-book/output/Urban_Tales_1B_Colour_Coded_Teachers_Book.pdf'; r=PdfReader(p); txt=''.join(x.extract_text() or '' for x in r.pages);print('pages',len(r.pages),'chars',len(txt),'exercises',all(x in txt for x in ['Exercise 1','Exercise 12','By and large'])) PY
Urban Tales 1B Colour Coded Teachers Book
PDF Document · PDF
Also do create a separate colorful handbook pdf file which shows list of difficult vocabulary words of proficiency B2+ to C1 proficiencywith their meanings from the article from student's book on topic urban legends and create 3 examples for each difficult vocabulary words of how how to use these words in sentences.
python - <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak, KeepTogether from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.pdfgen.canvas import Canvas from pathlib import Path outdir=Path('/tmp/workspace/new-teacher-book/output'); outdir.mkdir(parents=True,exist_ok=True) out=outdir/'Urban_Legends_B2_to_C1_Vocabulary_Handbook.pdf' terms=[ ('folklore','n. Traditional beliefs, stories and customs shared within a community, usually passed from generation to generation.',['Folklore often explains why a place is considered unlucky or sacred.','The researcher recorded local folklore before the older residents died.','Many urban legends are a modern form of folklore.']), ('encompass','v. To include a wide range of things or ideas.',['The course encompasses myths, legends and modern media stories.','Her job encompasses research, writing and public speaking.','The festival encompasses traditions from several cultures.']), ('generation to generation','phrase. Passed from parents or older people to younger people over many years.',['The recipe has been handed down from generation to generation.','The legend survived because it was retold from generation to generation.','Some family values are passed from generation to generation.']), ('word of mouth','n. Information shared by people speaking to one another rather than through official media.',['The restaurant became popular through word of mouth.','The rumour spread quickly by word of mouth.','We heard about the event by word of mouth before it appeared online.']), ('counteract','v. To reduce or prevent the effect of something negative.',['The school launched a campaign to counteract false rumours.','Exercise can help counteract the effects of sitting all day.','The police issued a statement to counteract public fear.']), ('circulate','v. To be passed from person to person or spread widely.',['Several versions of the story circulate online.','A false claim began to circulate after the accident.','The newspaper circulates throughout the city.']), ('authenticity','n. The quality of being genuine, real or believable.',['The old photographs gave the story an air of authenticity.','Experts examined the painting to confirm its authenticity.','Specific details can create authenticity even in a fictional story.']), ('on closer examination','phrase. After looking at something more carefully.',['On closer examination, the photo had been edited.','The argument seemed convincing, but on closer examination it was weak.','On closer examination, the report contained several errors.']), ('maimed','adj./v. Seriously injured, especially so that part of the body is permanently damaged.',['The worker was maimed in a serious factory accident.','The story describes a burglar being maimed by a guard dog.','The charity supports people who were maimed during conflict.']), ('grisly','adj. Extremely unpleasant or frightening, especially because it involves violence or death.',['The documentary included grisly details of the crime.','He avoided telling the children the grisly ending.','The urban legend has a grisly twist at the end.']), ('misogynistic','adj. Showing prejudice, dislike or hostility towards women.',['The critic described the film’s jokes as misogynistic.','Some old stories contain misogynistic ideas about women.','The company introduced training to challenge misogynistic behaviour.']), ('contemporary','adj. Belonging to the present time; modern.',['The legend reflects contemporary fears about technology.','The gallery displays contemporary art by local artists.','Contemporary society spreads rumours faster through social media.']), ('conspiracy theory','n. A belief that a secret group is responsible for an event, usually without reliable evidence.',['The claim was dismissed as a conspiracy theory because it had no evidence.','Conspiracy theories often become popular after frightening events.','She checks reliable sources before believing a conspiracy theory.']), ('boundaries','n. Limits or dividing lines between things or ideas.',['The boundaries between fact and fiction can be unclear online.','The article explores the boundaries between rumour and urban myth.','Good rules establish clear boundaries for acceptable behaviour.']), ('not cut and dried','idiom. Not clear, simple or easy to decide.',['The legal case is not cut and dried because both sides have evidence.','The difference between a rumour and a myth is not cut and dried.','Choosing the best solution is not cut and dried.']), ('arise','v. To begin to exist or happen, often unexpectedly.',['Rumours often arise after a shocking event.','A problem arose when the website stopped working.','Questions may arise during the discussion.']), ('first and foremost','phrase. More than anything else; most importantly.',['First and foremost, check whether a story is true.','The project is first and foremost about improving safety.','She is first and foremost a teacher, although she also writes books.']), ('sewage system','n. A network of pipes and facilities that carries wastewater away for treatment or disposal.',['The city is investing in a modern sewage system.','Flooding damaged part of the sewage system.','The alligator-in-the-sewer legend turns a sewage system into a frightening setting.'])] styles=getSampleStyleSheet() title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=23,leading=27,textColor=colors.HexColor('#163D77'),alignment=TA_CENTER,spaceAfter=6) sub=ParagraphStyle('sub',parent=styles['BodyText'],fontName='Helvetica',fontSize=10,leading=13,textColor=colors.HexColor('#4A4A4A'),alignment=TA_CENTER,spaceAfter=10) head=ParagraphStyle('head',parent=styles['Heading2'],fontName='Helvetica-Bold',fontSize=13,leading=16,textColor=colors.HexColor('#163D77'),spaceBefore=5,spaceAfter=5) term=ParagraphStyle('term',parent=styles['BodyText'],fontName='Helvetica-Bold',fontSize=14,leading=16,textColor=colors.white,spaceAfter=4) defn=ParagraphStyle('defn',parent=styles['BodyText'],fontName='Helvetica',fontSize=9,leading=12,textColor=colors.HexColor('#1F1F1F'),spaceAfter=4) ex=ParagraphStyle('ex',parent=styles['BodyText'],fontName='Helvetica',fontSize=8.7,leading=11.4,textColor=colors.HexColor('#1F1F1F'),spaceAfter=2) class Card(Spacer): def __init__(self,word,definition,examples,accent): self.word=word;self.definition=definition;self.examples=examples;self.accent=accent;Spacer.__init__(self,0,0) def wrap(self,w,h): self.w=w; self.ps=[Paragraph(self.word,term),Paragraph('<b>Meaning:</b> '+self.definition,defn),Paragraph('<b>Examples:</b>',ex)]+[Paragraph(f'{i}. {x}',ex) for i,x in enumerate(self.examples,1)] self.hs=[]; total=18 for p in self.ps: _,ph=p.wrap(w-24,h);self.hs.append(ph);total+=ph self.h=total;return w,total def draw(self): c=self.canv;c.saveState();c.setFillColor(colors.HexColor('#F7FAFF'));c.roundRect(0,0,self.w,self.h,8,fill=1,stroke=0);c.setFillColor(self.accent);c.roundRect(0,self.h-29,self.w,29,8,fill=1,stroke=0);c.rect(0,self.h-29,self.w,8,fill=1,stroke=0);c.restoreState();y=self.h-7 for idx,p in enumerate(self.ps): y-=self.hs[idx];p.drawOn(c,12,y) accents=['#7151A4','#197D9D','#BE5D38','#377D5B','#9C3D68','#5A6FBC'] story=[Paragraph('URBAN LEGENDS',title),Paragraph('B2+ to C1 Vocabulary Handbook | Meanings and sentence examples',sub)] story.append(Paragraph('How to use this handbook',head));story.append(Paragraph('Each card presents a higher-level word or phrase from the Urban Legends article in the Student’s Book. Read the meaning, say the examples aloud, and write one personal example of your own.',defn));story.append(Spacer(1,6)) for i,(w,d,e) in enumerate(terms): story.append(Card(w,d,e,colors.HexColor(accents[i%len(accents)])));story.append(Spacer(1,7)) class NC(Canvas): def __init__(self,*a,**k):Canvas.__init__(self,*a,**k);self.st=[] def showPage(self):self.st.append(dict(self.__dict__));self._startPage() def save(self): total=len(self.st) for s in self.st: self.__dict__.update(s);self.setStrokeColor(colors.HexColor('#163D77'));self.line(1.5*cm,1.1*cm,A4[0]-1.5*cm,1.1*cm);self.setFillColor(colors.HexColor('#555555'));self.setFont('Helvetica',8);self.drawString(1.5*cm,.72*cm,'Urban Legends B2+ to C1 Vocabulary Handbook');self.drawRightString(A4[0]-1.5*cm,.72*cm,f'Page {self._pageNumber} of {total}');Canvas.showPage(self) Canvas.save(self) doc=SimpleDocTemplate(str(out),pagesize=A4,leftMargin=1.45*cm,rightMargin=1.45*cm,topMargin=1.25*cm,bottomMargin=1.4*cm,title='Urban Legends B2 to C1 Vocabulary Handbook') doc.build(story,canvasmaker=NC) print(out,out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/new-teacher-book/output/Urban_Legends_B2_to_C1_Vocabulary_Handbook.pdf';r=PdfReader(p);t=' '.join(p.extract_text() or '' for p in r.pages);print('pages',len(r.pages),'terms OK',all(x in t for x in ['folklore','conspiracy theory','sewage system']),'chars',len(t)) PY
Urban Legends B2 to C1 Vocabulary Handbook
PDF Document · PDF
Please create some changes in the handbook pdf you have prepared, firstly don't mention anything extra on the top of handbook that it's for B2+ to C1 , please remove that text . Secondly the meaning of each vocabulary words coincide and mix with heading color and the meaning is not visible properly.pleaese make it look properly.
~/new-teacher-book/output
mkdir -p "/tmp/workspace/new-teacher-book/output" && python - <<'PY' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Flowable, KeepTogether from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.pdfgen.canvas import Canvas from pathlib import Path out=Path('/tmp/workspace/new-teacher-book/output/Urban_Legends_Vocabulary_Handbook_REVISED.pdf') terms=[ ('folklore','Traditional beliefs, stories and customs shared within a community, usually passed from generation to generation.',['Folklore often explains why a place is considered unlucky or sacred.','The researcher recorded local folklore before the older residents died.','Many urban legends are a modern form of folklore.']), ('encompass','To include a wide range of things or ideas.',['The course encompasses myths, legends and modern media stories.','Her job encompasses research, writing and public speaking.','The festival encompasses traditions from several cultures.']), ('generation to generation','Passed from parents or older people to younger people over many years.',['The recipe has been handed down from generation to generation.','The legend survived because it was retold from generation to generation.','Some family values are passed from generation to generation.']), ('word of mouth','Information shared by people speaking to one another rather than through official media.',['The restaurant became popular through word of mouth.','The rumour spread quickly by word of mouth.','We heard about the event by word of mouth before it appeared online.']), ('counteract','To reduce or prevent the effect of something negative.',['The school launched a campaign to counteract false rumours.','Exercise can help counteract the effects of sitting all day.','The police issued a statement to counteract public fear.']), ('circulate','To be passed from person to person or spread widely.',['Several versions of the story circulate online.','A false claim began to circulate after the accident.','The newspaper circulates throughout the city.']), ('authenticity','The quality of being genuine, real or believable.',['The old photographs gave the story an air of authenticity.','Experts examined the painting to confirm its authenticity.','Specific details can create authenticity even in a fictional story.']), ('on closer examination','After looking at something more carefully.',['On closer examination, the photo had been edited.','The argument seemed convincing, but on closer examination it was weak.','On closer examination, the report contained several errors.']), ('maimed','Seriously injured, especially so that part of the body is permanently damaged.',['The worker was maimed in a serious factory accident.','The story describes a burglar being maimed by a guard dog.','The charity supports people who were maimed during conflict.']), ('grisly','Extremely unpleasant or frightening, especially because it involves violence or death.',['The documentary included grisly details of the crime.','He avoided telling the children the grisly ending.','The urban legend has a grisly twist at the end.']), ('misogynistic','Showing prejudice, dislike or hostility towards women.',['The critic described the film’s jokes as misogynistic.','Some old stories contain misogynistic ideas about women.','The company introduced training to challenge misogynistic behaviour.']), ('contemporary','Belonging to the present time; modern.',['The legend reflects contemporary fears about technology.','The gallery displays contemporary art by local artists.','Contemporary society spreads rumours faster through social media.']), ('conspiracy theory','A belief that a secret group is responsible for an event, usually without reliable evidence.',['The claim was dismissed as a conspiracy theory because it had no evidence.','Conspiracy theories often become popular after frightening events.','She checks reliable sources before believing a conspiracy theory.']), ('boundaries','Limits or dividing lines between things or ideas.',['The boundaries between fact and fiction can be unclear online.','The article explores the boundaries between rumour and urban myth.','Good rules establish clear boundaries for acceptable behaviour.']), ('not cut and dried','Not clear, simple or easy to decide.',['The legal case is not cut and dried because both sides have evidence.','The difference between a rumour and a myth is not cut and dried.','Choosing the best solution is not cut and dried.']), ('arise','To begin to exist or happen, often unexpectedly.',['Rumours often arise after a shocking event.','A problem arose when the website stopped working.','Questions may arise during the discussion.']), ('first and foremost','More than anything else; most importantly.',['First and foremost, check whether a story is true.','The project is first and foremost about improving safety.','She is first and foremost a teacher, although she also writes books.']), ('sewage system','A network of pipes and facilities that carries wastewater away for treatment or disposal.',['The city is investing in a modern sewage system.','Flooding damaged part of the sewage system.','The alligator-in-the-sewer legend turns a sewage system into a frightening setting.'])] styles=getSampleStyleSheet() title=ParagraphStyle('title',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=24,leading=29,textColor=colors.HexColor('#163D77'),alignment=TA_CENTER,spaceAfter=7) sub=ParagraphStyle('sub',parent=styles['BodyText'],fontName='Helvetica',fontSize=10,leading=13,textColor=colors.HexColor('#444444'),alignment=TA_CENTER,spaceAfter=12) class Card(Flowable): def __init__(self,w,d,e,accent): super().__init__();self.word=w;self.definition=d;self.examples=e;self.accent=colors.HexColor(accent) def wrap(self,w,h): self.w=w word=ParagraphStyle('word',fontName='Helvetica-Bold',fontSize=13.5,leading=16,textColor=colors.white,spaceAfter=0) meaning=ParagraphStyle('meaning',fontName='Helvetica',fontSize=9.6,leading=13,textColor=colors.HexColor('#1D1D1D'),spaceAfter=5) ex=ParagraphStyle('ex',fontName='Helvetica',fontSize=9,leading=12,textColor=colors.HexColor('#1D1D1D'),spaceAfter=2) self.parts=[Paragraph(self.word,word),Paragraph('<b>Meaning:</b> '+self.definition,meaning),Paragraph('<b>Examples:</b>',ex)]+[Paragraph(f'{n}. {s}',ex) for n,s in enumerate(self.examples,1)] self.heights=[];total=0 for p in self.parts: _,ph=p.wrap(w-28,h);self.heights.append(ph);total+=ph self.header_h=self.heights[0]+14 self.h=total+25 return w,self.h def draw(self): c=self.canv;c.saveState();c.setFillColor(colors.HexColor('#F9FBFF'));c.setStrokeColor(colors.HexColor('#B4C7E6'));c.setLineWidth(.8);c.roundRect(0,0,self.w,self.h,8,fill=1,stroke=1);c.setFillColor(self.accent);c.roundRect(0,self.h-self.header_h,self.w,self.header_h,8,fill=1,stroke=0);c.rect(0,self.h-self.header_h,self.w,8,fill=1,stroke=0);c.restoreState() y=self.h-7 for p,ph in zip(self.parts,self.heights): y-=ph;p.drawOn(c,14,y) acc=['#3B6FB6','#9A4E9E','#1C8A80','#C46A35','#6B6AAA','#B34E62'] story=[Paragraph('URBAN LEGENDS VOCABULARY',title),Paragraph('Meanings and sentence examples',sub)] for i,x in enumerate(terms): story.append(KeepTogether([Card(*x,acc[i%len(acc)]),Spacer(1,7)])) class Num(Canvas): def __init__(self,*a,**k):Canvas.__init__(self,*a,**k);self.st=[] def showPage(self):self.st.append(dict(self.__dict__));self._startPage() def save(self): n=len(self.st) for s in self.st: self.__dict__.update(s);self.setStrokeColor(colors.HexColor('#163D77'));self.line(1.45*cm,1.05*cm,A4[0]-1.45*cm,1.05*cm);self.setFont('Helvetica',8);self.setFillColor(colors.HexColor('#555555'));self.drawString(1.45*cm,.68*cm,'Urban Legends Vocabulary Handbook');self.drawRightString(A4[0]-1.45*cm,.68*cm,f'Page {self._pageNumber} of {n}');Canvas.showPage(self) Canvas.save(self) doc=SimpleDocTemplate(str(out),pagesize=A4,leftMargin=1.45*cm,rightMargin=1.45*cm,topMargin=1.3*cm,bottomMargin=1.4*cm,title='Urban Legends Vocabulary Handbook') doc.build(story,canvasmaker=Num) print(out,out.stat().st_size) PY python - <<'PY' from pypdf import PdfReader p='/tmp/workspace/new-teacher-book/output/Urban_Legends_Vocabulary_Handbook_REVISED.pdf';r=PdfReader(p);t=' '.join(x.extract_text() or '' for x in r.pages);print('pages',len(r.pages),'B2+', 'B2+' in t,'terms',all(x in t for x in ['folklore','authenticity','sewage system'])) PY
Urban Legends Vocabulary Handbook REVISED
PDF Document · PDF