pdf_writing_tools 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pdf_writing_tools.rb +27 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '01850947c8686b987899d011697d5796c94ba7b3c3edd47dd95e77b1edf83437'
4
- data.tar.gz: bbc70c15e5bb7368342bcd81d2091cae811738abfb3ac5d8226dfc3814949656
3
+ metadata.gz: 5c9eda846aa608aa060dfcdf248785641d8157fd11a6854ca7bb28190ecff249
4
+ data.tar.gz: '09d6d26696ae73858b17c6cd41a5b228e021f661d9d8d6c8182be07b0dbe3ea9'
5
5
  SHA512:
6
- metadata.gz: a59da430b55240d7757a8f0fcd9eebc7d30be53562fea63e857e7782b8ad5db0e98f7a28824ec3d95a1749c0d68bfe489e1c47b341f317fdecd410c4d8ee8cf8
7
- data.tar.gz: 0e84e64bf4f74aa40a209261f1c6dddc1c1bf8726a647938744c1997e5f1d0f769af97977aa7d1d4a63d6bae835aadcee5de7044fc27a10f5fd807a7cfcb5cf9
6
+ metadata.gz: 3b3ee0196bc304ad36c7b4c08af7083b6a9b92a786b3f1a5dd500dae85278362c875822fdddb13950d232d3ba2af35794bb4491b9cdf83deb732736f523912ba
7
+ data.tar.gz: 3f315a5b62258ebdb244d4b7da40135047932a5626ec2401ddcf5bb4b24e5ad74b5104fdba7909498695e2681743cd65f27792526ebbd9b3c636ff75987a9379
@@ -263,6 +263,8 @@ module PdfWritingTools
263
263
 
264
264
  new_y = pdf_margin_top
265
265
 
266
+ overflowed = false
267
+
266
268
  loop do
267
269
  max_cell_height = 0
268
270
 
@@ -298,6 +300,11 @@ module PdfWritingTools
298
300
 
299
301
  r = draw_cell_auto_height(pdf, draw_simulation = true, x+offset, y, width, texts[i], cell_opts, auto_y)
300
302
 
303
+ if r[:overflow] && r[:overflow] == ""
304
+ overflowed = true
305
+ end
306
+
307
+
301
308
  if r[:height] > max_cell_height
302
309
  max_cell_height = r[:height]
303
310
  end
@@ -308,9 +315,16 @@ module PdfWritingTools
308
315
  # Non voglio che la riga ecceda il margine di pagina, quindi se così fosse
309
316
  # ricalcolo l'altezza di riga per non superare tale margine
310
317
  if y + max_cell_height > pdf_height - pdf_margin_bottom
311
- max_cell_height = pdf_height - pdf_margin_bottom - y
318
+ overflowed = true
319
+ #max_cell_height = pdf_height - pdf_margin_bottom - y
312
320
  end
313
321
 
322
+
323
+ if overflowed
324
+ pdf.start_new_page
325
+ y = pdf_margin_top # Posiziono il cursore ad inizio della nuova pagina
326
+ end
327
+
314
328
  # A seguito della simulazione, ho ottenuto l'altezza di riga...
315
329
  # ... ora passo al disegno vero e proprie delle celle...
316
330
  offset = 0
@@ -353,16 +367,18 @@ module PdfWritingTools
353
367
 
354
368
  texts = rtexts
355
369
 
356
- # Se nei testi residui, sono presenti solo stringhe vuote, posso uscire dal
357
- # loop, altrimenti, devo cambiare pagina e disegnare una nuova riga con i
358
- # testi rimanenti
359
- if !check_no_empty_string_presence(texts)
360
- new_y = y + max_cell_height
361
- break
362
- else
363
- pdf.start_new_page
364
- y = pdf_margin_top # Posiziono il cursore ad inizio della nuova pagina
365
- end
370
+ if false
371
+ # Se nei testi residui, sono presenti solo stringhe vuote, posso uscire dal
372
+ # loop, altrimenti, devo cambiare pagina e disegnare una nuova riga con i
373
+ # testi rimanenti
374
+ if !check_no_empty_string_presence(texts)
375
+ new_y = y + max_cell_height
376
+ break
377
+ else
378
+ pdf.start_new_page
379
+ y = pdf_margin_top # Posiziono il cursore ad inizio della nuova pagina
380
+ end
381
+ end
366
382
  end
367
383
 
368
384
  pdf.y = (pdf_height - new_y)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_writing_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - JSalvo1978
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-06 00:00:00.000000000 Z
11
+ date: 2024-01-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Plugin for write pdf in a simplified manner, using prawn as backend
14
14
  email: