Jelajahi Sumber

[#1] Center title between header logos, draw images in background, and shift top content margin to prevent collisions

Lange François 2 minggu lalu
induk
melakukan
75d13c06c2
37 mengubah file dengan 29 tambahan dan 22 penghapusan
  1. TEMPAT SAMPAH
      Project.pdf
  2. TEMPAT SAMPAH
      Retro Planning.pdf
  3. TEMPAT SAMPAH
      delivery.zip
  4. TEMPAT SAMPAH
      docs/Backup_Procedure.pdf
  5. TEMPAT SAMPAH
      docs/Data_Ingestion.pdf
  6. TEMPAT SAMPAH
      docs/Final_Report.pdf
  7. 10 9
      docs/Header_Footer_Antigravity.md
  8. TEMPAT SAMPAH
      docs/Header_Footer_Antigravity.pdf
  9. 3 1
      docs/Header_Footer_Gemini.md
  10. TEMPAT SAMPAH
      docs/Header_Footer_Gemini.pdf
  11. TEMPAT SAMPAH
      docs/Installation_Guide.pdf
  12. TEMPAT SAMPAH
      docs/Operator_Installation_Guide.pdf
  13. TEMPAT SAMPAH
      docs/Recommendations.pdf
  14. TEMPAT SAMPAH
      docs/Scrum_Artifacts.pdf
  15. TEMPAT SAMPAH
      docs/Scrum_Daily.pdf
  16. TEMPAT SAMPAH
      docs/Scrum_Plan.pdf
  17. TEMPAT SAMPAH
      docs/Scrum_Retro.pdf
  18. TEMPAT SAMPAH
      docs/Scrum_Review.pdf
  19. TEMPAT SAMPAH
      docs/Scrum_Wiki.pdf
  20. TEMPAT SAMPAH
      docs/Start_Stop_Procedures.pdf
  21. TEMPAT SAMPAH
      docs/Technical_Document.pdf
  22. TEMPAT SAMPAH
      docs/Test_Cases_Sprint8.pdf
  23. TEMPAT SAMPAH
      docs/URL_Formats.pdf
  24. TEMPAT SAMPAH
      docs/Uninstall_Guide.pdf
  25. TEMPAT SAMPAH
      docs/User_Description.pdf
  26. TEMPAT SAMPAH
      docs/User_Guide.pdf
  27. TEMPAT SAMPAH
      docs/WSL_Deployment.pdf
  28. TEMPAT SAMPAH
      docs/Wiki_Home.pdf
  29. TEMPAT SAMPAH
      docs/architecture.pdf
  30. TEMPAT SAMPAH
      docs/disaster_recovery_plan.pdf
  31. TEMPAT SAMPAH
      docs/distributed_deployment.pdf
  32. TEMPAT SAMPAH
      docs/docker_connection.pdf
  33. TEMPAT SAMPAH
      docs/project_report.pdf
  34. TEMPAT SAMPAH
      docs/retro_planning.pdf
  35. TEMPAT SAMPAH
      docs/taiga_audit_report.pdf
  36. TEMPAT SAMPAH
      docs/zabbix_monitoring.pdf
  37. 16 12
      scripts/generate_pdfs.py

TEMPAT SAMPAH
Project.pdf


TEMPAT SAMPAH
Retro Planning.pdf


TEMPAT SAMPAH
delivery.zip


TEMPAT SAMPAH
docs/Backup_Procedure.pdf


TEMPAT SAMPAH
docs/Data_Ingestion.pdf


TEMPAT SAMPAH
docs/Final_Report.pdf


+ 10 - 9
docs/Header_Footer_Antigravity.md

@@ -15,17 +15,17 @@ The layout bounds on a standard A4 page (595 x 842 points) are mapped as follows
 ```mermaid
 graph TD
     subgraph A4 Page Boundary [A4 Page Layout: 595 x 842 pt]
-        subgraph Top Margin Area [Top Margin: Y=0 to Y=54]
-            L_Logo["Left Logo: am.png<br/>X=48, Y=12<br/>(146.5 x 24.5 pt)"]
-            M_Title["Middle Title: Document Title<br/>X=Centered, Y=26"]
-            R_Logo["Right Logo: Bts.png<br/>X=479.9, Y=8<br/>(67.1 x 36.8 pt)"]
+        subgraph Top Margin Area [Top Margin: Y=0 to Y=60]
+            L_Logo["Left Logo: am.png<br/>X=48, Y=12<br/>(146.5 x 24.5 pt)<br/>[overlay=False]"]
+            M_Title["Middle Title: Document Title<br/>X=Centered in remaining space, Y=26"]
+            R_Logo["Right Logo: Bts.png<br/>X=479.9, Y=8<br/>(67.1 x 36.8 pt)<br/>[overlay=False]"]
         end
         
-        subgraph Content Area [Main Document Context: Y=54 to Y=788]
-            Content["HTML/CSS Layout Story Flow"]
+        subgraph Content Area [Main Document Context: Y=60 to Y=806]
+            Content["HTML/CSS Layout Story Flow<br/>[borders=(36, 60, -36, -36)]"]
         end
         
-        subgraph Bottom Margin Area [Bottom Margin: Y=788 to Y=842]
+        subgraph Bottom Margin Area [Bottom Margin: Y=806 to Y=842]
             L_Foot["Left Footer: lanfr144<br/>X=48, Y=820"]
             M_Foot["Middle Footer: Page X of Y<br/>X=Centered, Y=820"]
             R_Foot["Right Footer: DOPRO1<br/>X=width-48-width, Y=820"]
@@ -38,8 +38,9 @@ graph TD
 To ensure maximum visual fidelity when zoomed, follow these steps:
 1. **Load PNGs as Pixmaps**: Read the image size using PyMuPDF `fitz.Pixmap`.
 2. **Compute 10% Bounds**: Scale the pixel width and height to 10% for layout dimensions in points.
-3. **Draw Bounds**: Insert the image using `page.insert_image(rect, filename)`. The full resolution is embedded in the PDF, keeping quality high when zoomed.
-4. **Optimized Saving**: Always save the PDF with deflate compression, garbage collection, and linearization:
+3. **Draw Bounds in Background**: Insert the image using `page.insert_image(rect, filename, overlay=False)`. Setting `overlay=False` places the header pictures in the background, keeping other text on the foreground.
+4. **Prevent Header Collisions**: Instantiate the markdown section with a top border margin of 60pt (e.g. `borders=(36, 60, -36, -36)`) so that layout text begins below the header logo graphics.
+5. **Optimized Saving**: Always save the PDF with deflate compression, garbage collection, and linearization:
    ```python
    doc.save(pdf_file, clean=True, garbage=3, deflate=True)
    ```

TEMPAT SAMPAH
docs/Header_Footer_Antigravity.pdf


+ 3 - 1
docs/Header_Footer_Gemini.md

@@ -47,12 +47,13 @@ To implement the Gemini standard paged layout, include the following CSS rules i
 ```css
 @page {
     size: A4;
-    margin: 54pt 48pt 54pt 48pt;
+    margin: 60pt 48pt 54pt 48pt; /* Set top margin to 60pt to prevent collisions */
     
     @top-left {
         content: url("am.png");
         image-resolution: 300dpi;
         vertical-align: middle;
+        z-index: -1; /* Place in background */
     }
     
     @top-center {
@@ -61,6 +62,7 @@ To implement the Gemini standard paged layout, include the following CSS rules i
         font-size: 8pt;
         color: #808080;
         vertical-align: middle;
+        text-align: center; /* Center between left/right margin boxes */
     }
     
     @top-right {

TEMPAT SAMPAH
docs/Header_Footer_Gemini.pdf


TEMPAT SAMPAH
docs/Installation_Guide.pdf


TEMPAT SAMPAH
docs/Operator_Installation_Guide.pdf


TEMPAT SAMPAH
docs/Recommendations.pdf


TEMPAT SAMPAH
docs/Scrum_Artifacts.pdf


TEMPAT SAMPAH
docs/Scrum_Daily.pdf


TEMPAT SAMPAH
docs/Scrum_Plan.pdf


TEMPAT SAMPAH
docs/Scrum_Retro.pdf


TEMPAT SAMPAH
docs/Scrum_Review.pdf


TEMPAT SAMPAH
docs/Scrum_Wiki.pdf


TEMPAT SAMPAH
docs/Start_Stop_Procedures.pdf


TEMPAT SAMPAH
docs/Technical_Document.pdf


TEMPAT SAMPAH
docs/Test_Cases_Sprint8.pdf


TEMPAT SAMPAH
docs/URL_Formats.pdf


TEMPAT SAMPAH
docs/Uninstall_Guide.pdf


TEMPAT SAMPAH
docs/User_Description.pdf


TEMPAT SAMPAH
docs/User_Guide.pdf


TEMPAT SAMPAH
docs/WSL_Deployment.pdf


TEMPAT SAMPAH
docs/Wiki_Home.pdf


TEMPAT SAMPAH
docs/architecture.pdf


TEMPAT SAMPAH
docs/disaster_recovery_plan.pdf


TEMPAT SAMPAH
docs/distributed_deployment.pdf


TEMPAT SAMPAH
docs/docker_connection.pdf


TEMPAT SAMPAH
docs/project_report.pdf


TEMPAT SAMPAH
docs/retro_planning.pdf


TEMPAT SAMPAH
docs/taiga_audit_report.pdf


TEMPAT SAMPAH
docs/zabbix_monitoring.pdf


+ 16 - 12
scripts/generate_pdfs.py

@@ -155,17 +155,17 @@ def main():
                         landscape_part = '## 2. Project File Catalog & Documentation' + parts2[0]
                         portrait_part2 = '## 3. Directory Structure Map' + parts2[1]
                         
-                        pdf.add_section(Section(portrait_part1, paper_size="A4", root=root_dir), user_css=user_css)
-                        pdf.add_section(Section(landscape_part, paper_size="A4-L", root=root_dir), user_css=user_css)
-                        pdf.add_section(Section(portrait_part2, paper_size="A4", root=root_dir), user_css=user_css)
+                        pdf.add_section(Section(portrait_part1, paper_size="A4", root=root_dir, borders=(36, 60, -36, -36)), user_css=user_css)
+                        pdf.add_section(Section(landscape_part, paper_size="A4-L", root=root_dir, borders=(36, 60, -36, -36)), user_css=user_css)
+                        pdf.add_section(Section(portrait_part2, paper_size="A4", root=root_dir, borders=(36, 60, -36, -36)), user_css=user_css)
                     else:
                         print("WARNING: Could not find Directory Structure Map heading. Defaulting to full portrait.")
-                        pdf.add_section(Section(md_content, paper_size="A4", root=root_dir), user_css=user_css)
+                        pdf.add_section(Section(md_content, paper_size="A4", root=root_dir, borders=(36, 60, -36, -36)), user_css=user_css)
                 else:
                     print("WARNING: Could not find Project File Catalog heading. Defaulting to full portrait.")
-                    pdf.add_section(Section(md_content, paper_size="A4", root=root_dir), user_css=user_css)
+                    pdf.add_section(Section(md_content, paper_size="A4", root=root_dir, borders=(36, 60, -36, -36)), user_css=user_css)
             else:
-                pdf.add_section(Section(md_content, paper_size="A4", root=root_dir), user_css=user_css)
+                pdf.add_section(Section(md_content, paper_size="A4", root=root_dir, borders=(36, 60, -36, -36)), user_css=user_css)
                 
             # Post-process compiled PDF to insert header and footer
             import fitz
@@ -208,23 +208,27 @@ def main():
                 height = page.rect.height
                 
                 # Header layout
-                # Left: am.png picture (if exists) at 10% size
+                # Left: am.png picture (if exists) at 10% size, drawn in background
                 if os.path.exists(am_path):
                     image_rect = fitz.Rect(48, 12, 48 + width_am, 12 + height_am)
-                    page.insert_image(image_rect, filename=am_path)
+                    page.insert_image(image_rect, filename=am_path, overlay=False)
                 
-                # Right: Bts.png logo (if exists) at 10% size
+                # Right: Bts.png logo (if exists) at 10% size, drawn in background
                 if os.path.exists(bts_path):
                     bts_rect = fitz.Rect(width - 48 - width_bts, 8, width - 48, 8 + height_bts)
-                    page.insert_image(bts_rect, filename=bts_path)
+                    page.insert_image(bts_rect, filename=bts_path, overlay=False)
                 
-                # Middle: document title (centered)
+                # Middle: document title centered in the space between the two pictures
                 fontsize = 8
                 fontname = "helv"
                 m_width = fitz.get_text_length(doc_title, fontname=fontname, fontsize=fontsize)
                 
+                space_start = 48 + width_am
+                space_end = width - 48 - width_bts
+                title_x = space_start + (space_end - space_start - m_width) / 2
+                
                 page.insert_text(
-                    fitz.Point((width - m_width) / 2, 26),
+                    fitz.Point(title_x, 26),
                     doc_title,
                     fontname=fontname,
                     fontsize=fontsize,