Skip to content

fix(pdf): Solved PDF export extremely small margins issue #948#1008

Open
krahulshharmaa wants to merge 2 commits intoCrustack:mainfrom
krahulshharmaa:fix/pdf-margin-issue-fixed
Open

fix(pdf): Solved PDF export extremely small margins issue #948#1008
krahulshharmaa wants to merge 2 commits intoCrustack:mainfrom
krahulshharmaa:fix/pdf-margin-issue-fixed

Conversation

@krahulshharmaa
Copy link
Copy Markdown
Contributor

@krahulshharmaa krahulshharmaa commented Apr 30, 2026

PDF export-margin issue solved.

Summary by CodeRabbit

  • Style
    • Improved print formatting for notes with enhanced typography, margins, and image presentation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

📝 Walkthrough

Walkthrough

The PR adds inline CSS styling to the HTML output generated by BaseNote.toHtml(). The styling configures print page margins, typography properties (font, line-height, word wrapping), image sizing and presentation, and spacing for headings and paragraphs. No logic or functional changes are introduced.

Changes

Cohort / File(s) Summary
HTML Styling
app/src/main/java/com/philkes/notallyx/data/model/ModelExtensions.kt
Adds inline CSS <style> section to HTML output with rules for print margins, typography adjustments, image sizing (max-width, auto height, margins), and spacing for headings and paragraphs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A dash of CSS, so fine and neat,
Makes the printed pages look complete,
Margins set just right, typography divine,
Images flow in a perfect line,
Now your notes print with all their might! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: adding CSS styling to fix PDF export margins. It clearly identifies both the problem (small margins) and the solution (fix), and is specific to the issue #948 referenced in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 12 minutes and 18 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/com/philkes/notallyx/data/model/ModelExtensions.kt (1)

203-211: ⚡ Quick win

Use overflow-wrap for reliable long-word wrapping in prints.

In the added CSS, you set word-wrap: break-word; (Line 210). word-wrap is legacy; overflow-wrap is the modern, widely supported equivalent for controlling wrapping in browsers/print engines.

🛠️ Proposed change
-        body {
-            font-family: sans-serif;
-            line-height: 1.5;
-            word-wrap: break-word;
-        }
+        body {
+            font-family: sans-serif;
+            line-height: 1.5;
+            word-wrap: break-word;
+            overflow-wrap: break-word;
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/com/philkes/notallyx/data/model/ModelExtensions.kt` around
lines 203 - 211, Replace the legacy CSS property by updating the CSS block that
currently contains "word-wrap: break-word;" (inside the `@page/body` CSS snippet)
to use the modern "overflow-wrap: break-word;" property instead; locate the
"word-wrap" occurrence in ModelExtensions.kt and change it to "overflow-wrap" so
long words wrap reliably in print.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/src/main/java/com/philkes/notallyx/data/model/ModelExtensions.kt`:
- Around line 203-211: Replace the legacy CSS property by updating the CSS block
that currently contains "word-wrap: break-word;" (inside the `@page/body` CSS
snippet) to use the modern "overflow-wrap: break-word;" property instead; locate
the "word-wrap" occurrence in ModelExtensions.kt and change it to
"overflow-wrap" so long words wrap reliably in print.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b12a0a2-b207-4556-b2ea-e8868a26ab00

📥 Commits

Reviewing files that changed from the base of the PR and between cd2a7b6 and a4ebb9b.

📒 Files selected for processing (1)
  • app/src/main/java/com/philkes/notallyx/data/model/ModelExtensions.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants