pdf_writing_tools 0.0.17 → 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.
- checksums.yaml +4 -4
- data/lib/pdf_writing_tools.rb +31 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c9eda846aa608aa060dfcdf248785641d8157fd11a6854ca7bb28190ecff249
|
4
|
+
data.tar.gz: '09d6d26696ae73858b17c6cd41a5b228e021f661d9d8d6c8182be07b0dbe3ea9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b3ee0196bc304ad36c7b4c08af7083b6a9b92a786b3f1a5dd500dae85278362c875822fdddb13950d232d3ba2af35794bb4491b9cdf83deb732736f523912ba
|
7
|
+
data.tar.gz: 3f315a5b62258ebdb244d4b7da40135047932a5626ec2401ddcf5bb4b24e5ad74b5104fdba7909498695e2681743cd65f27792526ebbd9b3c636ff75987a9379
|
data/lib/pdf_writing_tools.rb
CHANGED
@@ -137,6 +137,10 @@ module PdfWritingTools
|
|
137
137
|
|
138
138
|
|
139
139
|
result = 0
|
140
|
+
|
141
|
+
# Il testo in modalità simulazione, verrà generato in posizione y_pos1, tenendo conto del padding.
|
142
|
+
# In questo modo, quando andrò a disegnare la cella vera e propria in posizione y_pos2, il testo
|
143
|
+
# avrà il suo "spazio" (padding)
|
140
144
|
y_pos1 = auto_y ? (pdf.cursor - top_padding) : (pdf_height - y - top_padding)
|
141
145
|
y_pos2 = auto_y ? pdf.cursor : (pdf_height - y)
|
142
146
|
|
@@ -173,7 +177,6 @@ module PdfWritingTools
|
|
173
177
|
pdf.stroke_color(border_color) # Colore del bordo
|
174
178
|
|
175
179
|
|
176
|
-
|
177
180
|
if no_background
|
178
181
|
else
|
179
182
|
pdf.fill_and_stroke_rectangle([x, y_pos2], (w + left_padding + right_padding), (h+top_padding+bottom_padding))
|
@@ -259,10 +262,10 @@ module PdfWritingTools
|
|
259
262
|
pdf_margin_right = opts[:pdf_margin_right] || 2.cm
|
260
263
|
|
261
264
|
new_y = pdf_margin_top
|
262
|
-
pdf.y = pdf.y + y
|
263
265
|
|
264
|
-
|
266
|
+
overflowed = false
|
265
267
|
|
268
|
+
loop do
|
266
269
|
max_cell_height = 0
|
267
270
|
|
268
271
|
# 1 - Cerco l'altezza della riga
|
@@ -297,6 +300,11 @@ module PdfWritingTools
|
|
297
300
|
|
298
301
|
r = draw_cell_auto_height(pdf, draw_simulation = true, x+offset, y, width, texts[i], cell_opts, auto_y)
|
299
302
|
|
303
|
+
if r[:overflow] && r[:overflow] == ""
|
304
|
+
overflowed = true
|
305
|
+
end
|
306
|
+
|
307
|
+
|
300
308
|
if r[:height] > max_cell_height
|
301
309
|
max_cell_height = r[:height]
|
302
310
|
end
|
@@ -307,9 +315,16 @@ module PdfWritingTools
|
|
307
315
|
# Non voglio che la riga ecceda il margine di pagina, quindi se così fosse
|
308
316
|
# ricalcolo l'altezza di riga per non superare tale margine
|
309
317
|
if y + max_cell_height > pdf_height - pdf_margin_bottom
|
310
|
-
|
318
|
+
overflowed = true
|
319
|
+
#max_cell_height = pdf_height - pdf_margin_bottom - y
|
311
320
|
end
|
312
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
|
+
|
313
328
|
# A seguito della simulazione, ho ottenuto l'altezza di riga...
|
314
329
|
# ... ora passo al disegno vero e proprie delle celle...
|
315
330
|
offset = 0
|
@@ -352,16 +367,18 @@ module PdfWritingTools
|
|
352
367
|
|
353
368
|
texts = rtexts
|
354
369
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
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
|
365
382
|
end
|
366
383
|
|
367
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.
|
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-
|
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:
|