🧩 Day 13 of my #PDFwithPython journey
Today I learned how to find and inspect text fragments in a PDF — the first step toward text replacement!
💡 What I learned:
- TextFragmentAbsorber searches text by phrase or area
- Each fragment gives position and style info
#Python #LearnPython #100DaysOfCode
🧩 Day 12 of my #PDFwithPython journey
Today I experimented with text rotation in Aspose.PDF — rotating text fragments at different angles to create dynamic layouts.
🎨 Output: text rotated at multiple angles!
Perfect for creative layouts and titles.
#Python #PDF #LearnPython #100DaysOfCode
🧩 Day 11 of my #PDFwithPython journey
Today I tried creating an ordered list using LaTeX inside a PDF!
Aspose.PDF can render LaTeX environments like enumerate directly — no HTML required ✨
📄 Output: a perfectly formatted numbered list — rendered from LaTeX syntax!
#Python #PDF #100DaysOfCode
🧩 Day 10 of my #PDFwithPython journey
Today I learned how to create bulleted lists in a PDF using HTML — super quick and clean.
✅ Aspose.PDF renders <ul><li></li></ul> automatically — no manual formatting.
#Python #PDF #100DaysOfCode
import aspose.pdf as ap, os document = ap.Document() page = document.pages.add() lorem_path = os.path.join("E:\\Samples\\Text", "lorem.txt") text = ( open(lorem_path, "r", encoding="utf-8").read() if os.path.exists(lorem_path) else "Lorem ipsum text not found." ) fragment = ap.text.TextFragment(text) fragment.text_state.font_size = 12 fragment.text_state.line_spacing = 16 # Custom line spacing page.paragraphs.add(fragment) document.save("line_spacing.pdf")
🧩 Day 9 of my #PDFwithPython journey
Today I worked with line spacing — a key formatting option when rendering longer text blocks in PDFs. Increasing line spacing improves readability, especially for paragraphs and multi-line content.
#Python #PDF #LearnPython #100DaysOfCode
import aspose.pdf as ap from aspose.pdf.text import TextFragment, FontRepository doc = ap.Document() page = doc.pages.add() for spacing in [2.0, 1.0, 0.75]: fragment = TextFragment("Sample Text with character spacing") fragment.text_state.font = FontRepository.find_font("Arial") fragment.text_state.font_size = 14 fragment.text_state.character_spacing = spacing page.paragraphs.add(fragment) doc.save("character_spacing.pdf")
🧩 Day 8 of my #PDFwithPython journey
Today I explored character spacing in Aspose.PDF for Python — a simple way to control how tight or loose text appears in a PDF.
🔍 What I learned: Useful for typography tweaks. A small change can dramatically affect readability
#Python #LearnPython #100DaysOfCode
🧩 Day 7 of my #PDFwithPython journey
Today I experimented with radial gradient shading on text using aspose.pdf.
This feature lets you fill text with a circular gradient — here from 🔴 red to 🔵 blue — creating a vibrant, eye-catching PDF title.
#Python #100DaysOfCode #GradientText
import aspose.pdf as ap document = ap.Document() page = document.pages.add() text = ap.text.TextFragment( "This is the transparent text. " "This is the transparent text. " "This is the transparent text." ) text.text_state.foreground_color = ap.Color.from_argb(0, 0, 255, 0) page.paragraphs.add(text) document.save("transparent_text.pdf")
🧩 Day 6 of my #PDFwithPython journey
Today I experimented with transparent text — a neat way to make text blend naturally with the page background.
🎨 The result: by adjusting the alpha (A) value, you can fine-tune the opacity for watermark effects.
#Python #PDF #LearnPython #100DaysOfCode
import aspose.pdf as ap document = ap.Document() page = document.pages.add() latex_content = "$ \\sqrt{x^2+y^2} $" latex_fragment = ap.TeXFragment(latex_content) page.paragraphs.add(latex_fragment) document.save("latex_fragment.pdf")
🧩 Day 5 of my #PDFwithPython journey
Today I learned how to add LaTeX formulas directly into a PDF using aspose.pdf.
Math in PDFs just got easier — no image rendering or manual layout!
Aspose.PDF automatically converts LaTeX syntax into beautiful, scalable math symbols 🧮
#LaTeX #100DaysOfCode
import aspose.pdf as ap document = ap.Document() page = document.pages.add() html_content = "<h1>Header <i>1</i></h1>" for i in range(5): html_content += f"<p>Paragraph <b>{i+1}</b></p>" html_content += "a<sub>2</sub>+b<sup>3<sup>" html_fragment = ap.HtmlFragment(html_content) page.paragraphs.add(html_fragment) document.save("html_fragment.pdf")
🧩 Day 4 of my #PDFwithPython journey
Today I explored how to insert HTML-formatted text directly into a PDF.
Headings, bold or italic text, subscripts, and superscripts — all render beautifully!
No need to manually style paragraphs — HTML does the job!
#Python #PDF #100DaysOfCode
import aspose.pdf as ap doc = ap.Document() page = doc.pages.add() text = "Lorem ipsum sample text..." para = ap.text.TextParagraph() para.first_line_indent = 20 para.rectangle = ap.Rectangle(80, 800, 400, 200, True) para.formatting_options.wrap_mode = ( ap.text.TextFormattingOptions.WordWrapMode.BY_WORDS ) frag = ap.text.TextFragment(text) frag.text_state.font = ( ap.text.FontRepository.find_font("Times New Roman") ) frag.text_state.font_size = 12 para.append_line(frag) ap.text.TextBuilder(page).append_paragraph(para) doc.save("paragraph_text.pdf")
🧩 Day 3 of my #PDFwithPython journey
Today I explored formatted paragraphs in Aspose.PDF for Python — including indentation, wrapping.
🧠 What I learned:
- Paragraphs can have precise boundaries and indentation
- TextBuilder + TextParagraph = full layout control
#LearnPython #PDF #100DaysOfCode