Please create a colorful handbook pdf from the file attached , make Russian translation of of the text under headline " voluntarism " ,and also write meaning of words from lust "check these words" write their meanings in English and under that Russian translation.
~/
~/attachments/54814df2-d6bf-471e-b51a-70ada68dcd8d
python -c "from pypdf import PdfReader; p='/tmp/workspace/attachments/54814df2-d6bf-471e-b51a-70ada68dcd8d/DOC-20260927-WA0006.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)]"
~/
mkdir -p "/tmp/workspace/voluntary-work-handbook/src" "/tmp/workspace/voluntary-work-handbook/output"
~/voluntary-work-handbook/src/create_handbook.py
from reportlab.lib import colors
from reportlab.lib.colors import HexColor
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
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.lib import utils
from reportlab.pdfbase.pdfmetrics import stringWidth
import os
OUT = '/tmp/workspace/voluntary-work-handbook/output/Voluntary_Work_Russian_Handbook.pdf'
os.makedirs(os.path.dirname(OUT), exist_ok=True)
FONT = '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'
FONT_B = '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf'
pdfmetrics.registerFont(TTFont('DejaVu', FONT))
pdfmetrics.registerFont(TTFont('DejaVuBold', FONT_B))
NAVY=HexColor('#183153'); BLUE=HexColor('#2563EB'); TEAL=HexColor('#0F9D8B'); GREEN=HexColor('#3BB273')
ORANGE=HexColor('#F59E0B'); PINK=HexColor('#E85D75'); LIGHTBLUE=HexColor('#EAF3FF'); PALE=HexColor('#F7FAFC')
DARK=HexColor('#172B4D'); MUTED=HexColor('#52616B'); PURPLE=HexColor('#7C3AED')
styles=getSampleStyleSheet()
styles.add(ParagraphStyle(name='CoverTitle', fontName='DejaVuBold', fontSize=30, leading=36, textColor=colors.white, alignment=TA_CENTER, spaceAfter=10))
styles.add(ParagraphStyle(name='CoverSub', fontName='DejaVu', fontSize=13, leading=18, textColor=colors.white, alignment=TA_CENTER))
styles.add(ParagraphStyle(name='H1X', fontName='DejaVuBold', fontSize=21, leading=27, textColor=NAVY, spaceBefore=0, spaceAfter=10))
styles.add(ParagraphStyle(name='H2X', fontName='DejaVuBold', fontSize=13, leading=17, textColor=BLUE, spaceBefore=10, spaceAfter=6))
styles.add(ParagraphStyle(name='BodyX', fontName='DejaVu', fontSize=10.1, leading=14.2, textColor=DARK, spaceAfter=8))
styles.add(ParagraphStyle(name='SmallX', fontName='DejaVu', fontSize=8.8, leading=11.5, textColor=MUTED))
styles.add(ParagraphStyle(name='QuoteX', fontName='DejaVuBold', fontSize=12, leading=16, textColor=colors.white, alignment=TA_CENTER))
styles.add(ParagraphStyle(name='WordX', fontName='DejaVuBold', fontSize=9.3, leading=12, textColor=NAVY))
styles.add(ParagraphStyle(name='DefX', fontName='DejaVu', fontSize=8.8, leading=11.4, textColor=DARK))
styles.add(ParagraphStyle(name='RusX', fontName='DejaVu', fontSize=8.6, leading=11.1, textColor=PURPLE))
def P(text, style='BodyX'):
return Paragraph(text, styles[style])
def header_footer(canvas, doc):
canvas.saveState()
w,h=A4
canvas.setFillColor(NAVY)
canvas.rect(0,h-0.58*cm,w,0.58*cm,fill=1,stroke=0)
canvas.setFillColor(colors.white)
canvas.setFont('DejaVuBold',8)
canvas.drawString(1.35*cm,h-0.39*cm,'VOLUNTARY WORK | ENGLISH-RUSSIAN HANDBOOK')
canvas.setFillColor(MUTED)
canvas.setFont('DejaVu',8)
canvas.drawRightString(w-1.35*cm,0.55*cm,f'{doc.page}')
canvas.restoreState()
def cover(canvas, doc):
canvas.saveState(); w,h=A4
canvas.setFillColor(NAVY); canvas.rect(0,0,w,h,fill=1,stroke=0)
# color blocks
canvas.setFillColor(BLUE); canvas.circle(w*0.14,h*0.86,2.8*cm,fill=1,stroke=0)
canvas.setFillColor(TEAL); canvas.circle(w*0.88,h*0.20,3.6*cm,fill=1,stroke=0)
canvas.setFillColor(ORANGE); canvas.circle(w*0.84,h*0.82,1.3*cm,fill=1,stroke=0)
canvas.setFillColor(PINK); canvas.circle(w*0.17,h*0.15,1.4*cm,fill=1,stroke=0)
# small illustrations/symbols
canvas.setFillColor(colors.white); canvas.setFont('DejaVuBold',52); canvas.drawCentredString(w/2,h*0.64,'VOLUNTARY')
canvas.drawCentredString(w/2,h*0.55,'WORK')
canvas.setFont('DejaVu',17); canvas.drawCentredString(w/2,h*0.46,'ВОЛОНТЁРСТВО')
canvas.setFillColor(HexColor('#DDEBFF')); canvas.setFont('DejaVu',12)
canvas.drawCentredString(w/2,h*0.39,'Reading • Russian translation • Key vocabulary')
canvas.setFillColor(colors.white); canvas.setFont('DejaVuBold',30)
canvas.drawCentredString(w/2,h*0.27,'♥ ✦ ☀')
canvas.setFont('DejaVu',10); canvas.setFillColor(HexColor('#DDEBFF'))
canvas.drawCentredString(w/2,1.6*cm,'A colourful learning companion based on the supplied text')
canvas.restoreState()
doc=SimpleDocTemplate(OUT,pagesize=A4,rightMargin=1.35*cm,leftMargin=1.35*cm,topMargin=1.2*cm,bottomMargin=1.15*cm)
story=[]
story.append(Spacer(1, 15.2*cm)); story.append(PageBreak())
# Original reading
story.append(P('1. Read: Voluntary Work', 'H1X'))
story.append(P('How to make a difference!', 'H2X'))
intro = '''More and more young people are taking on volunteer work nowadays. Some even travel to the other side of the world and do unpaid work for a charity or other non-profit organisation there. They help to build homes for poor families, teach children English, take care of orphans, or help to protect an endangered species. There is a wide variety of voluntary jobs to choose from.'''
p2 = '''A number of charity groups organise educational programmes for children around the world. Many students volunteer for these types of projects. They teach subjects like English and Mathematics to children while staying in their community and getting to know the people and their culture. It is also a great opportunity for them to work and train with local teachers and develop their own skills. It is a learning experience for both the children and the teacher.'''
p3 = '''Young people who are good with their hands or simply would like to help in a very practical way can participate in one of the many construction projects. Several charity organisations help build houses or schools for poor children around the world. In the village of Kamakwie in Sierra Leone, for example, a team of young volunteers built a secondary school for poor orphans. Other similar projects are going on across poor villages of Africa, making sure that kids get an education.'''
p4 = '''For people interested in wildlife, conservation groups organise volunteer holidays throughout the world. You can help wildlife research in countries like Kenya and Botswana or protect turtles in Mexico, Zanzibar, or elsewhere. On Redang Island in Malaysia volunteers come from all over the world to help conserve the endangered green turtle. Participants monitor the turtles that come onto the beach and protect them and their eggs. They also get to enjoy the beach and even snorkel with the turtles sometimes.'''
p5 = '''A volunteer holiday is for people who want to make a difference in the world and are prepared to give up their own time, money, and effort to do it. Volunteers have to be realistic though and understand that they cannot change the world in two or three weeks. To some volunteers it seems that they are not doing much by helping out for only a couple of weeks but, in fact, every bit of help counts. Thanks to young volunteers, the lives of millions of people around the world are improving and, in their eyes, the sun is probably shining brighter than it used to.'''
for x in [intro,p2,p3,p4,p5]: story.append(P(x))
story.append(Spacer(1,4))
callout=Table([[P('Think about it: Which kind of voluntary work would you choose: teaching, building, or wildlife conservation?', 'QuoteX')]], colWidths=[17.9*cm])
callout.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),TEAL),('BOX',(0,0),(-1,-1),0,TEAL),('LEFTPADDING',(0,0),(-1,-1),14),('RIGHTPADDING',(0,0),(-1,-1),14),('TOPPADDING',(0,0),(-1,-1),10),('BOTTOMPADDING',(0,0),(-1,-1),10)]))
story.append(callout); story.append(PageBreak())
# Russian translation
story.append(P('2. Voluntarism: Russian Translation', 'H1X'))
story.append(P('Как изменить мир к лучшему!', 'H2X'))
translations=[
'''Сегодня всё больше молодых людей занимаются волонтёрской работой. Некоторые даже отправляются на другой конец света и бесплатно работают там на благотворительную или другую некоммерческую организацию. Они помогают строить дома для бедных семей, обучают детей английскому языку, заботятся о сиротах или помогают защищать исчезающие виды. Существует широкий выбор видов волонтёрской работы.''',
'''Ряд благотворительных групп организует образовательные программы для детей по всему миру. Многие учащиеся становятся волонтёрами таких проектов. Они преподают детям такие предметы, как английский язык и математика, живя в их сообществе и знакомясь с людьми и их культурой. Это также прекрасная возможность работать и проходить обучение вместе с местными учителями, а также развивать собственные навыки. Это учебный опыт и для детей, и для учителя.''',
'''Молодые люди, которые умеют работать руками или просто хотят помогать практическим способом, могут участвовать в одном из многочисленных строительных проектов. Несколько благотворительных организаций помогают строить дома или школы для малоимущих детей по всему миру. Например, в деревне Камакви в Сьерра-Леоне команда молодых волонтёров построила среднюю школу для бедных сирот. Похожие проекты осуществляются в бедных деревнях Африки, чтобы дети могли получать образование.''',
'''Для людей, интересующихся дикой природой, природоохранные группы организуют волонтёрские поездки по всему миру. Можно помогать исследованиям дикой природы в таких странах, как Кения и Ботсвана, или защищать черепах в Мексике, Занзибаре и других местах. На острове Реданг в Малайзии волонтёры приезжают со всего мира, чтобы помочь сохранить находящуюся под угрозой исчезновения зелёную черепаху. Участники наблюдают за черепахами, выходящими на пляж, и защищают их и их яйца. Они также могут наслаждаться пляжем и иногда даже плавать с трубкой рядом с черепахами.''',
'''Волонтёрская поездка предназначена для людей, которые хотят изменить мир к лучшему и готовы пожертвовать для этого своим временем, деньгами и усилиями. Однако волонтёрам нужно быть реалистами и понимать, что они не могут изменить мир за две или три недели. Некоторым кажется, что, помогая всего пару недель, они делают недостаточно, но на самом деле важна любая помощь. Благодаря молодым волонтёрам жизнь миллионов людей по всему миру улучшается, и в их глазах солнце, вероятно, светит ярче, чем прежде.'''
]
for t in translations: story.append(P(t))
story.append(PageBreak())
# vocabulary
story.append(P('3. Check These Words', 'H1X'))
story.append(P('Meaning in English, followed by the Russian translation.', 'SmallX'))
story.append(Spacer(1,6))
words=[
('volunteer work','Work done willingly to help others, usually without payment.','волонтёрская работа; добровольная работа'),
('unpaid work','Work for which a person receives no money.','неоплачиваемая работа'),
('charity','An organisation or activity that helps people in need.','благотворительная организация; благотворительность'),
('non-profit organisation','An organisation that uses its money to support its mission, not to make profit for owners.','некоммерческая организация'),
('orphan','A child whose parents have died or who has no parents to care for them.','сирота'),
('endangered species','A type of animal or plant that is at risk of disappearing forever.','вид, находящийся под угрозой исчезновения'),
('project','A planned piece of work with a particular aim.','проект'),
('community','People living in the same area or sharing common interests.','сообщество; община'),
('develop skills','To improve abilities through learning and practice.','развивать навыки'),
('practical','Related to real actions and useful everyday experience.','практический; прикладной'),
('participate in','To take part in an activity or event.','участвовать в'),
('conservation','The protection of nature, animals, plants, and natural resources.','охрана природы; сохранение'),
('wildlife research','The scientific study of animals living in nature.','исследование дикой природы'),
('protect','To keep someone or something safe from harm.','защищать; охранять'),
('conserve','To protect something from damage, loss, or waste.','сохранять; беречь'),
('monitor','To watch and check something regularly over a period of time.','наблюдать; контролировать'),
('effort','Physical or mental energy used to do something.','усилие; старание'),
('improve','To become better, or make something better.','улучшать(ся)')]
rows=[[P('WORD','WordX'),P('MEANING IN ENGLISH','WordX'),P('РУССКИЙ ПЕРЕВОД','WordX')]]
for w,e,r in words: rows.append([P(w,'WordX'),P(e,'DefX'),P(r,'RusX')])
table=Table(rows,colWidths=[3.65*cm,8.05*cm,6.2*cm],repeatRows=1)
table.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),LIGHTBLUE),('GRID',(0,0),(-1,-1),0.35,HexColor('#C9D7E7')),('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,PALE])]))
story.append(table)
story.append(PageBreak())
# practice
story.append(P('4. Quick Review', 'H1X'))
story.append(P('Use the reading and vocabulary pages to answer.', 'SmallX'))
qs=[
'1. Name three ways volunteers can help people or nature.',
'2. Why do volunteers teach English and Mathematics in communities?',
'3. What did the young volunteers build in Kamakwie, Sierra Leone?',
'4. What do participants do to help green turtles on Redang Island?',
'5. Why should volunteers be realistic about a short volunteer holiday?'
]
for q in qs:
story.append(P(q,'H2X'))
line=Table([['']],colWidths=[17.9*cm],rowHeights=[1.1*cm])
line.setStyle(TableStyle([('LINEBELOW',(0,0),(-1,-1),0.5,HexColor('#A9B8C8'))]))
story.append(line); story.append(Spacer(1,5))
story.append(Spacer(1,8))
box=Table([[P('<b>Remember:</b> Every bit of help counts. Small actions can make a real difference.', 'BodyX')]],colWidths=[17.9*cm])
box.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),HexColor('#FFF2D8')),('BOX',(0,0),(-1,-1),0.7,ORANGE),('LEFTPADDING',(0,0),(-1,-1),12),('RIGHTPADDING',(0,0),(-1,-1),12),('TOPPADDING',(0,0),(-1,-1),9),('BOTTOMPADDING',(0,0),(-1,-1),9)]))
story.append(box)
doc.build(story,onFirstPage=cover,onLaterPages=header_footer)
print(OUT)
python "/tmp/workspace/voluntary-work-handbook/src/create_handbook.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/voluntary-work-handbook/output/Voluntary_Work_Russian_Handbook.pdf'; r=PdfReader(p); print('pages=',len(r.pages)); print('first page text:',(r.pages[0].extract_text() or '')[:200]); print('last page text:',(r.pages[-1].extract_text() or '')[:200])"
**/*.ttf in /usr/share/fonts
~/voluntary-work-handbook/src/create_handbook.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/voluntary-work-handbook/src/create_handbook.py'
python "/tmp/workspace/voluntary-work-handbook/src/create_handbook.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/voluntary-work-handbook/output/Voluntary_Work_Russian_Handbook.pdf'; r=PdfReader(p); print('pages=',len(r.pages)); print((r.pages[1].extract_text() or '')[:280]); print((r.pages[2].extract_text() or '')[:280])"
~/voluntary-work-handbook/output
Voluntary Work Russian Handbook
PDF Document · PDF