Przeglądaj źródła

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

Lange François 2 tygodni temu
rodzic
commit
75d13c06c2

BIN
Project.pdf


BIN
Retro Planning.pdf


BIN
delivery.zip


BIN
docs/Backup_Procedure.pdf


BIN
docs/Data_Ingestion.pdf


BIN
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)
    ```

BIN
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 {

BIN
docs/Header_Footer_Gemini.pdf


BIN
docs/Installation_Guide.pdf


BIN
docs/Operator_Installation_Guide.pdf


BIN
docs/Recommendations.pdf


BIN
docs/Scrum_Artifacts.pdf


BIN
docs/Scrum_Daily.pdf


BIN
docs/Scrum_Plan.pdf


BIN
docs/Scrum_Retro.pdf


BIN
docs/Scrum_Review.pdf


BIN
docs/Scrum_Wiki.pdf


BIN
docs/Start_Stop_Procedures.pdf


BIN
docs/Technical_Document.pdf


BIN
docs/Test_Cases_Sprint8.pdf


BIN
docs/URL_Formats.pdf


BIN
docs/Uninstall_Guide.pdf


BIN
docs/User_Description.pdf


BIN
docs/User_Guide.pdf


BIN
docs/WSL_Deployment.pdf


BIN
docs/Wiki_Home.pdf


BIN
docs/architecture.pdf


BIN
docs/disaster_recovery_plan.pdf


BIN
docs/distributed_deployment.pdf


BIN
docs/docker_connection.pdf


BIN
docs/project_report.pdf


BIN
docs/retro_planning.pdf


BIN
docs/taiga_audit_report.pdf


BIN
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,