Commit 38ee36d
committed
fix: Implement proper Gotenberg markdown conversion according to official docs
🔧 Gotenberg API Compliance:
- Follow official Gotenberg markdown conversion pattern from docs
- Create HTML wrapper file (index.html) with toHTML template function
- Send both index.html and .md file as separate files to Gotenberg
- Add proper CSS styling for professional PDF appearance
📚 Based on Gotenberg Documentation:
- /forms/chromium/convert/markdown requires index.html + *.md files
- HTML wrapper uses {{ toHTML "filename.md" }} template function
- Replaced \pagebreak with CSS page-break-before: always
🛠️ Implementation Details:
- Generate HTML wrapper with embedded CSS for styling
- Send files as multipart form with correct content types
- Proper cleanup of both temporary files
- Enhanced error handling for both file types
✅ Expected Result:
- Proper PDF generation from markdown reports
- Professional styling with fonts, tables, and page breaks
- Resolves Gotenberg 400 'form file index.html is required' error1 parent 45f992c commit 38ee36d
2 files changed
+41
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
545 | | - | |
| 545 | + | |
546 | 546 | | |
| 547 | + | |
| 548 | + | |
547 | 549 | | |
548 | 550 | | |
549 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
550 | 578 | | |
551 | 579 | | |
552 | 580 | | |
| |||
567 | 595 | | |
568 | 596 | | |
569 | 597 | | |
570 | | - | |
571 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
572 | 604 | | |
573 | 605 | | |
574 | 606 | | |
| |||
619 | 651 | | |
620 | 652 | | |
621 | 653 | | |
622 | | - | |
| 654 | + | |
623 | 655 | | |
624 | 656 | | |
| 657 | + | |
625 | 658 | | |
626 | 659 | | |
627 | 660 | | |
| |||
637 | 670 | | |
638 | 671 | | |
639 | 672 | | |
| 673 | + | |
| 674 | + | |
640 | 675 | | |
641 | 676 | | |
642 | 677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
0 commit comments