Marthee commited on
Commit
f720988
·
verified ·
1 Parent(s): 25c148f

Update Doors_Schedule.py

Browse files
Files changed (1) hide show
  1. Doors_Schedule.py +20 -0
Doors_Schedule.py CHANGED
@@ -531,6 +531,26 @@ def add_bluebeam_count_annotations(pdf_bytes, locations):
531
  pdf_document = fitz.open("pdf", pdf_stream.read()) # Open PDF in memory
532
 
533
  page = pdf_document[0] # First page
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  if len(locations[0]) == 4:
535
  for loc in locations:
536
  coor, lbl, clr,w = loc
 
531
  pdf_document = fitz.open("pdf", pdf_stream.read()) # Open PDF in memory
532
 
533
  page = pdf_document[0] # First page
534
+ if len(locations[0]) == 3:
535
+ for loc in locations:
536
+ coor, lbl, clr = loc
537
+ clr = (clr[0] / 255, clr[1] / 255, clr[2] / 255)
538
+ for cor in coor:
539
+ #Create a Circle annotation (Count Markup)
540
+ annot = page.add_circle_annot(
541
+ fitz.Rect(cor[0] - 10, cor[1] - 10, cor[0] + 10, cor[1] + 10) # Small circle
542
+ )
543
+
544
+ #Assign required Bluebeam metadata
545
+ annot.set_colors(stroke=clr, fill=(1, 1, 1)) # Set stroke color and fill white
546
+ annot.set_border(width=2) # Border thickness
547
+ annot.set_opacity(1) # Fully visible
548
+
549
+ #Set annotation properties for Bluebeam Count detection
550
+ annot.set_info("name", lbl) # Unique name for each count
551
+ annot.set_info("subject", "Count") #Bluebeam uses "Count" for Count markups
552
+ annot.set_info("title", lbl) # Optional
553
+ annot.update() # Apply changes
554
  if len(locations[0]) == 4:
555
  for loc in locations:
556
  coor, lbl, clr,w = loc