Please create a handbook pdf, write list of words along with their meanings in English and also write Russian translation under every sentence.write the meaning of words from exercise 1 , later translate the article in Russian and write meaning of "Check these words", and don't forget about Russian translation

Reading File
Browsing Directory

~/

Running Command

python -c "from pypdf import PdfReader; p='/tmp/workspace/attachments/24cb70fe-3d8d-4cea-9e5f-a988c2b1a60c/DOC-20260915-WA0020.pdf'; r=PdfReader(p); print('PAGES',len(r.pages)); [print('---PAGE',i+1,'---\n'+(pg.extract_text() or '')) for i,pg in enumerate(r.pages)]"

Browsing Directory

~/

Reading File
Running Command

mkdir -p "/tmp/workspace/adventure-sports-handbook/src" "/tmp/workspace/adventure-sports-handbook/output" && fc-list | grep -i 'DejaVuSans.ttf' | head -1

Running Command

python -c "import os; paths=['/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf','/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf','/usr/share/fonts/truetype/liberation2/LiberationSans-Regular.ttf']; print([(p,os.path.exists(p)) for p in paths])"

Running Command

python -c "from matplotlib import font_manager as fm; fs=fm.findSystemFonts(); print([f for f in fs if 'DejaVuSans' in f or 'NotoSans' in f][:10])"

Writing File

~/adventure-sports-handbook/src/create_handbook.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, Table, TableStyle, KeepTogether
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.pdfmetrics import stringWidth

OUT='/tmp/workspace/adventure-sports-handbook/output/Adventure_Sports_Bilingual_Handbook.pdf'
FONT='/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf'
pdfmetrics.registerFont(TTFont('Noto', FONT))
pdfmetrics.registerFont(TTFont('NotoBold', FONT))
styles=getSampleStyleSheet()
styles.add(ParagraphStyle(name='TitleX',fontName='NotoBold',fontSize=22,leading=28,textColor=colors.HexColor('#123B5D'),alignment=TA_CENTER,spaceAfter=12))
styles.add(ParagraphStyle(name='Sub',fontName='Noto',fontSize=10.5,leading=15,textColor=colors.HexColor('#35566F'),alignment=TA_CENTER))
styles.add(ParagraphStyle(name='H',fontName='NotoBold',fontSize=15,leading=19,textColor=colors.HexColor('#123B5D'),spaceBefore=12,spaceAfter=7))
styles.add(ParagraphStyle(name='En',fontName='NotoBold',fontSize=10.4,leading=14,spaceAfter=2,textColor=colors.HexColor('#162B3B')))
styles.add(ParagraphStyle(name='Ru',fontName='Noto',fontSize=10.2,leading=14,spaceAfter=7,textColor=colors.HexColor('#505050')))
styles.add(ParagraphStyle(name='Small',fontName='Noto',fontSize=8.4,leading=11))

def P(t, sty='En'): return Paragraph(t,styles[sty])
def sentence(en,ru): return [P(en,'En'),P('Русский: '+ru,'Ru')]
def footer(canvas,doc):
    canvas.saveState(); canvas.setStrokeColor(colors.HexColor('#C9DCE6')); canvas.line(1.8*cm,1.35*cm,19.2*cm,1.35*cm)
    canvas.setFont('Noto',8); canvas.setFillColor(colors.HexColor('#536D7A')); canvas.drawString(1.8*cm,0.85*cm,'Adventure Sports | Bilingual Study Handbook'); canvas.drawRightString(19.2*cm,0.85*cm,str(doc.page)); canvas.restoreState()

story=[]
story += [Spacer(1,3*cm),P('ADVENTURE SPORTS','TitleX'),P('English-Russian Bilingual Handbook','Sub'),Spacer(1,.5*cm),P('Based on the reading “Take a Peep” about world champion freediver Sara Campbell.','Sub'),Spacer(1,1.0*cm),P('Contents','H'),P('1. Exercise 1 vocabulary<br/>2. Reading text: English with Russian translation<br/>3. “Check these words”: meanings and Russian translations<br/>4. Useful completed phrases','Small'),PageBreak()]

story += [P('1. Exercise 1: Adventure Sports Vocabulary','H'),P('Each entry gives a simple English meaning followed by its Russian translation.','Ru')]
sports=[
('mountain biking','riding a bicycle on rough paths in the mountains or countryside','горный велосипедный спорт; катание на горном велосипеде'),
('street luge','racing downhill while lying on a small wheeled board','уличный льюж; скоростной спуск на доске с колёсами лёжа'),
('motocross','motorcycle racing over rough outdoor tracks','мотокросс'),
('speed skiing','skiing straight down a steep slope at extremely high speed','скоростной спуск на лыжах'),
('windsurfing','moving over water on a board with a sail','виндсёрфинг'),
('freediving','diving underwater while holding one breath, without breathing equipment','фридайвинг; ныряние на задержке дыхания'),
('paragliding','flying through the air with a light fabric wing','парапланеризм'),
('rock climbing','climbing up natural rock faces or artificial climbing walls','скалолазание'),
('white-water rafting','travelling down fast, rough river water in an inflatable boat','сплав по бурной реке на надувной лодке (рафтинге)')]
data=[[P('<b>Word / phrase</b>','Small'),P('<b>Meaning in English</b>','Small'),P('<b>Russian translation</b>','Small')]]+[[P(a,'Small'),P(b,'Small'),P(c,'Small')] for a,b,c in sports]
t=Table(data,colWidths=[4.1*cm,8.0*cm,5.3*cm],repeatRows=1)
t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),colors.HexColor('#D7EAF3')),('GRID',(0,0),(-1,-1),.35,colors.HexColor('#AFC6D2')),('VALIGN',(0,0),(-1,-1),'TOP'),('LEFTPADDING',(0,0),(-1,-1),6),('RIGHTPADDING',(0,0),(-1,-1),6),('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,colors.HexColor('#F6FAFC')])]))
story += [t,PageBreak(),P('2. Reading: “Take a Peep”','H'),P('Read each original sentence, then the Russian translation directly underneath.','Ru')]
paras=[
[("Sara Campbell takes a final deep breath and dives into the sea.","Сара Кэмпбелл делает последний глубокий вдох и ныряет в море."),("She goes down into the blue water and carries on going down ... and down.","Она погружается в голубую воду и продолжает опускаться всё ниже и ниже."),("Soon, the people on the surface can’t see her any more.","Вскоре люди на поверхности больше не могут её видеть."),("She doesn’t have an air tank, just a wetsuit, goggles and a monofin - a large flipper that makes her look like a modern-day mermaid.","У неё нет баллона с воздухом, только гидрокостюм, очки и моноласта - большой плавник, из-за которого она похожа на современную русалку."),("Sara is a world champion freediver and uses only one breath to take her as deep as she can go and back again to the surface!","Сара - чемпионка мира по фридайвингу и использует только один вдох, чтобы погрузиться настолько глубоко, насколько может, а затем вернуться на поверхность!"),("She holds four world records and a world championship gold medal.","Ей принадлежат четыре мировых рекорда и золотая медаль чемпионата мира.")],
[("Freediving is one of the world’s most dangerous sports.","Фридайвинг - один из самых опасных видов спорта в мире."),("On the way down, a freediver’s lungs shrink to the size of a lemon and on the way back they double in size.","Во время погружения лёгкие фридайвера сжимаются до размера лимона, а при подъёме увеличиваются вдвое."),("But to Sara, all this comes naturally.","Но для Сары всё это даётся естественно."),("After years of practising yoga and meditation, she can hold her breath for over five minutes and her lungs are 22% larger than other women her size.","После многих лет занятий йогой и медитацией она может задерживать дыхание более чем на пять минут, а её лёгкие на 22% больше, чем у других женщин такого же телосложения.")],
[("Sara feels completely comfortable underwater.","Сара чувствует себя под водой совершенно комфортно."),("“I just jump in and feel terrific.","«Я просто ныряю и чувствую себя великолепно."),("There are no distractions.","Там нет ничего, что отвлекало бы."),("Dogs aren’t barking, phones aren’t ringing, and nobody is making noise next door.","Собаки не лают, телефоны не звонят, и никто не шумит по соседству."),("It’s totally silent.”","Там совершенно тихо»." )],
[("Sara has a busy life and loves every minute of it.","У Сары насыщенная жизнь, и ей нравится каждая её минута."),("She’s presenting a TV show, planning environmental campaigns, and training to set a new world record!","Она ведёт телешоу, планирует экологические кампании и тренируется, чтобы установить новый мировой рекорд!")]]
for para in paras:
    for en,ru in para: story += sentence(en,ru)
    story.append(Spacer(1,5))
story.append(PageBreak())

story += [P('3. “Check these words”','H'),P('Definitions in English with Russian translations.','Ru')]
words=[
('final','last; happening at the end','последний, заключительный'),('deep breath','a large amount of air taken into the lungs','глубокий вдох'),('dive','to go headfirst into water; to swim down under water','нырять; погружаться'),('carry on','to continue','продолжать'),('surface','the top layer of water or ground','поверхность'),('hold a record','to have achieved the best official result','владеть рекордом'),('air tank','a container of compressed air used for breathing underwater','баллон с воздухом'),('wetsuit','a close-fitting suit that keeps a water-sports participant warm','гидрокостюм'),('goggles','protective glasses worn over the eyes in water','очки для плавания'),('monofin','one large swimming fin worn on both feet','моноласта'),('flipper','a flat rubber fin worn on a foot for swimming','ласт'),('mermaid','an imaginary female creature with a woman’s upper body and a fish’s tail','русалка'),('champion','a person or team that has won a competition','чемпион, чемпионка'),('lungs','the two organs used for breathing','лёгкие'),('shrink','to become smaller','сжиматься, уменьшаться'),('double in size','to become twice as large','увеличиваться вдвое'),('come naturally','to be easy because it happens without special effort','даваться естественно'),('meditation','quiet mental practice used to focus and relax','медитация'),('hold her breath','to stop breathing for a period of time','задерживать дыхание'),('distraction','something that takes attention away from what one is doing','то, что отвлекает; отвлекающий фактор'),('bark','the sharp sound a dog makes','лаять'),('totally silent','completely without sound','совершенно тихий; абсолютно беззвучный'),('environmental campaign','an organized effort to protect the environment or raise awareness','экологическая кампания')]
data=[[P('<b>Word / phrase</b>','Small'),P('<b>Meaning in English</b>','Small'),P('<b>Russian translation</b>','Small')]]+[[P(a,'Small'),P(b,'Small'),P(c,'Small')] for a,b,c in words]
t=Table(data,colWidths=[4.1*cm,8.0*cm,5.3*cm],repeatRows=1)
t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),colors.HexColor('#D7EAF3')),('GRID',(0,0),(-1,-1),.3,colors.HexColor('#AFC6D2')),('VALIGN',(0,0),(-1,-1),'TOP'),('LEFTPADDING',(0,0),(-1,-1),5),('RIGHTPADDING',(0,0),(-1,-1),5),('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,colors.HexColor('#F6FAFC')])]))
story += [t,PageBreak(),P('4. Useful completed phrases','H'),P('The word box can be used to complete the exercise as follows. Russian translations are included.','Ru')]
answers=[('Freedivers’ lungs <b>shrink</b> as they swim down.','Лёгкие фридайверов сжимаются, когда они погружаются.'),('She <b>took a final deep breath</b> as she dove into the cold water.','Она сделала последний глубокий вдох, когда нырнула в холодную воду.'),('It’s <b>totally silent</b> underwater! There’s no noise at all.','Под водой совершенно тихо! Там совсем нет шума.'),('Divers usually wear an <b>air tank</b> so that they can breathe at the bottom of the sea.','Дайверы обычно надевают баллон с воздухом, чтобы дышать на дне моря.'),('Nobody is better than her at freediving. She’s the world <b>champion</b>.','Никто не лучше её во фридайвинге. Она чемпионка мира.'),('Her <b>goggles</b> keep the water out of her eyes when she dives.','Её очки не дают воде попасть в глаза, когда она ныряет.')]
for a,b in answers: story += sentence(a,b)
story += [Spacer(1,8),P('Opposites from the reading','H')]
opp=[('expand','shrink','расширяться - сжиматься'),('old','modern-day','старый - современный'),('quiet','noisy','тихий - шумный'),('awful','terrific','ужасный - великолепный'),('safe','dangerous','безопасный - опасный'),('shallow','deep','мелкий - глубокий')]
data=[[P('<b>Word</b>','Small'),P('<b>Opposite</b>','Small'),P('<b>Russian</b>','Small')]]+[[P(a,'Small'),P(b,'Small'),P(c,'Small')]for a,b,c in opp]
t=Table(data,colWidths=[5*cm,5*cm,7.4*cm]); t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),colors.HexColor('#D7EAF3')),('GRID',(0,0),(-1,-1),.35,colors.HexColor('#AFC6D2')),('VALIGN',(0,0),(-1,-1),'TOP'),('LEFTPADDING',(0,0),(-1,-1),6),('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5)])); story.append(t)

doc=SimpleDocTemplate(OUT,pagesize=A4,rightMargin=1.8*cm,leftMargin=1.8*cm,topMargin=1.55*cm,bottomMargin=1.7*cm,title='Adventure Sports Bilingual Handbook',author='Orris')
doc.build(story,onFirstPage=footer,onLaterPages=footer)
print(OUT)
Running Command

python "/tmp/workspace/adventure-sports-handbook/src/create_handbook.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/adventure-sports-handbook/output/Adventure_Sports_Bilingual_Handbook.pdf'; r=PdfReader(p); print('pages',len(r.pages),'size',__import__('os').path.getsize(p)); print((r.pages[1].extract_text() or '')[:300])"

Created the bilingual English-Russian handbook PDF. It includes:
  • Meanings and Russian translations for all Exercise 1 sports
  • The full article translated sentence by sentence into Russian
  • English meanings and Russian translations for every “Check these words” item
  • Completed phrases from the exercise with Russian translations
  • Opposites vocabulary

Adventure Sports Bilingual Handbook

PDF Document · PDF

This is a shared conversation. Sign in to Orris to start your own chat.