from docx import Document
import zipfile
# Re-define file paths
doc_path = “/mnt/data/ch2-partb.docx”
html_path = “/mnt/data/ai_chapter_fully_protected.html”
zip_path = “/mnt/data/ai_chapter_fully_protected.zip”
# Load Word document
document = Document(doc_path)
# Create HTML content with text protection and right-click disable script
html_parts = [
‘‘,
‘‘
]
for para in document.paragraphs:
text = para.text.strip()
if text:
html_parts.append(f’
{text}
‘) html_parts.append(‘‘) # Save HTML file with open(html_path, “w”, encoding=”utf-8″) as f: f.write(“\n”.join(html_parts)) # Create ZIP containing the protected HTML with zipfile.ZipFile(zip_path, ‘w’) as zipf: zipf.write(html_path, arcname=”ai_chapter_fully_protected.html”) zip_path


