debug_pre_issue.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import os
  2. from markdown_pdf import MarkdownPdf, Section
  3. import fitz
  4. docs_dir = r"c:/Users/lanfr144/Documents/DOPRO1/Antigravity/Food/docs"
  5. md_file = os.path.join(docs_dir, "Installation_Guide.md")
  6. with open(md_file, "r", encoding="utf-8") as f:
  7. md_content = f.read()
  8. # Current CSS from generate_pdfs.py
  9. user_css = """
  10. * {
  11. color: #1a1a1a !important;
  12. }
  13. body {
  14. font-family: 'Helvetica', 'Arial', sans-serif !important;
  15. color: #1a1a1a !important;
  16. background-color: #ffffff !important;
  17. }
  18. h1, h2, h3, h4, h5, h6, h1 *, h2 *, h3 *, h4 *, h5 *, h6 * {
  19. color: #000000 !important;
  20. margin-top: 18px !important;
  21. margin-bottom: 8px !important;
  22. }
  23. pre {
  24. background-color: #f8f9fa !important;
  25. border: 1px solid #e9ecef !important;
  26. padding: 2px !important;
  27. margin-top: 8px !important;
  28. margin-bottom: 16px !important;
  29. border-radius: 3px !important;
  30. font-family: 'Courier New', 'Courier', monospace !important;
  31. font-size: 10pt !important;
  32. white-space: pre-wrap !important;
  33. word-break: break-all !important;
  34. }
  35. pre code, pre * {
  36. font-family: 'Courier New', 'Courier', monospace !important;
  37. font-size: 10pt !important;
  38. color: #212529 !important;
  39. background-color: #f8f9fa !important;
  40. white-space: pre-wrap !important;
  41. word-break: break-all !important;
  42. }
  43. code {
  44. font-family: 'Courier New', 'Courier', monospace !important;
  45. font-size: 10pt !important;
  46. color: #b02a37 !important;
  47. background-color: #f8f9fa !important;
  48. padding: 2px 4px !important;
  49. border-radius: 3px !important;
  50. white-space: pre-wrap !important;
  51. word-break: break-all !important;
  52. }
  53. a, a * {
  54. color: #0d6efd !important;
  55. }
  56. blockquote, blockquote * {
  57. color: #555555 !important;
  58. border-left: 4px solid #ccc !important;
  59. padding-left: 10px !important;
  60. }
  61. table, tr, td, th, table * {
  62. color: #1a1a1a !important;
  63. border-color: #cccccc !important;
  64. }
  65. th {
  66. background-color: #f2f2f2 !important;
  67. }
  68. ul, li {
  69. list-style-type: disc !important;
  70. }
  71. """
  72. pdf = MarkdownPdf()
  73. section = Section(md_content, paper_size="A4", root=docs_dir)
  74. pdf.add_section(section, user_css=user_css)
  75. pdf.save("scratch/debug_install.pdf")
  76. doc = fitz.open("scratch/debug_install.pdf")
  77. print("Text on Page 2:")
  78. print(doc[1].get_text())
  79. doc.close()