Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

features/Provide method to define keyword #439

Merged
merged 5 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/assets/examples/metadatas/v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func GetMaroto() core.Maroto {
WithCreator("creator", false).
WithSubject("subject", false).
WithTitle("title", false).
WithKeywords("keyword", false).
WithCreationDate(time.Now()).
Build()

Expand Down
Binary file modified docs/assets/pdf/addpagev2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/backgroundv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/barcodegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/billingv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/cellstylev2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/compressionv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/customdimensionsv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/customfontv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/custompagev2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/datamatrixgridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/disablepagebreakv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/footerv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/headerv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/imagegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/linegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/listv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/lowmemoryv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/marginsv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/maxgridsumv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/mergepdfv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/metadatasv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/orientationv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/pagenumberv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/parallelismv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/protectionv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/qrgridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/signaturegridv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/simplestv2.pdf
Binary file not shown.
Binary file modified docs/assets/pdf/textgridv2.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/assets/text/addpagev2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 19.23ms, executions: [19.23ms]
add_page -> avg: 8937.00ns, executions: [8.94μs]
generate -> avg: 18.45ms, executions: [18.45ms]
add_page -> avg: 7013.00ns, executions: [7.01μs]
file_size -> 5.64Kb
4 changes: 2 additions & 2 deletions docs/assets/text/backgroundv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 1267.26ms, executions: [1267.26ms]
add_page -> avg: 6442.00ns, executions: [6.44μs]
generate -> avg: 2169.54ms, executions: [2169.54ms]
add_page -> avg: 8596.00ns, executions: [8.60μs]
file_size -> 897.39Kb
4 changes: 2 additions & 2 deletions docs/assets/text/barcodegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 6.20ms, executions: [6.20ms]
add_row -> avg: 805.40ns, executions: [1.79μs, 0.62μs, 0.56μs, 0.39μs, 0.66μs]
generate -> avg: 8.15ms, executions: [8.15ms]
add_row -> avg: 895.60ns, executions: [2.03μs, 0.62μs, 0.69μs, 0.44μs, 0.69μs]
file_size -> 16.01Kb
10 changes: 5 additions & 5 deletions docs/assets/text/billingv2.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
generate -> avg: 82.88ms, executions: [82.88ms]
header -> avg: 1.07μs, executions: [1.07μs]
footer -> avg: 291.00ns, executions: [291.00ns]
add_row -> avg: 396.00ns, executions: [341.00ns, 451.00ns]
add_rows -> avg: 560.50ns, executions: [200.00ns, 921.00ns]
generate -> avg: 72.08ms, executions: [72.08ms]
header -> avg: 1.59μs, executions: [1.59μs]
footer -> avg: 200.00ns, executions: [200.00ns]
add_row -> avg: 8947.00ns, executions: [0.54μs, 17.35μs]
add_rows -> avg: 987.00ns, executions: [0.46μs, 1.51μs]
file_size -> 231.70Kb
4 changes: 2 additions & 2 deletions docs/assets/text/cellstylev2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 39.87ms, executions: [39.87ms]
add_rows -> avg: 163.28ns, executions: [1.41μs, 0.15μs, 0.13μs, 0.05μs, 0.16μs, 0.06μs, 0.05μs, 0.05μs, 0.16μs, 0.04μs, 0.04μs, 0.04μs, 0.05μs, 0.04μs, 0.03μs, 0.04μs, 0.99μs, 0.04μs, 0.04μs, 0.04μs, 0.05μs, 0.04μs, 0.05μs, 0.04μs, 0.05μs, 0.04μs, 1.46μs, 0.13μs, 0.13μs, 0.04μs, 0.62μs, 0.04μs, 0.05μs, 0.04μs, 0.42μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.05μs, 0.04μs, 0.15μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 1.65μs, 0.12μs, 0.11μs, 0.04μs, 0.12μs, 0.04μs, 0.05μs, 0.04μs]
generate -> avg: 96.35ms, executions: [96.35ms]
add_rows -> avg: 691.98ns, executions: [2.05μs, 1.46μs, 0.61μs, 0.74μs, 0.61μs, 0.80μs, 0.21μs, 0.70μs, 0.73μs, 0.62μs, 0.47μs, 0.77μs, 0.22μs, 0.66μs, 0.18μs, 0.68μs, 3.45μs, 0.89μs, 0.18μs, 0.73μs, 0.18μs, 0.73μs, 0.29μs, 0.78μs, 0.19μs, 0.74μs, 3.17μs, 1.14μs, 0.60μs, 0.78μs, 0.62μs, 0.80μs, 0.18μs, 0.71μs, 0.53μs, 0.87μs, 0.15μs, 0.63μs, 0.18μs, 0.79μs, 1.09μs, 0.64μs, 0.58μs, 0.43μs, 0.10μs, 0.45μs, 0.11μs, 0.46μs, 0.11μs, 0.45μs, 0.11μs, 0.45μs, 2.67μs, 0.74μs, 0.34μs, 0.47μs, 0.39μs, 0.46μs, 0.14μs, 0.45μs]
file_size -> 28.60Kb
4 changes: 2 additions & 2 deletions docs/assets/text/compressionv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 15.30ms, executions: [15.30ms]
add_rows -> avg: 523.25ns, executions: [1.27μs, 0.39μs, 0.32μs, 0.11μs]
generate -> avg: 14.42ms, executions: [14.42ms]
add_rows -> avg: 581.25ns, executions: [1.06μs, 0.46μs, 0.70μs, 0.10μs]
file_size -> 224.69Kb
4 changes: 2 additions & 2 deletions docs/assets/text/customdimensionsv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 3.72ms, executions: [3.72ms]
add_row -> avg: 4428.00ns, executions: [4.43μs]
generate -> avg: 3.54ms, executions: [3.54ms]
add_row -> avg: 1783.00ns, executions: [1.78μs]
file_size -> 205.24Kb
6 changes: 3 additions & 3 deletions docs/assets/text/customfontv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 117.13ms, executions: [117.13ms]
add_row -> avg: 224.21ns, executions: [1.47μs, 0.23μs, 0.23μs, 0.13μs, 0.23μs, 0.14μs, 0.20μs, 0.45μs, 0.45μs, 0.18μs, 0.23μs, 0.11μs, 0.11μs, 0.12μs, 0.12μs, 0.11μs, 0.82μs, 0.12μs, 0.11μs, 0.13μs, 0.12μs, 0.11μs, 0.12μs, 0.16μs, 0.11μs, 0.11μs, 0.11μs, 0.12μs, 0.11μs, 0.11μs, 0.12μs, 0.11μs, 0.39μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.26μs, 0.16μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.12μs, 0.11μs, 0.10μs, 0.11μs, 0.13μs, 2.88μs, 0.18μs, 0.20μs, 0.12μs, 0.20μs, 0.13μs, 0.11μs, 0.11μs, 0.21μs, 0.25μs, 0.11μs, 0.11μs, 0.12μs, 0.11μs, 0.11μs, 0.11μs, 0.27μs, 0.12μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.12μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.13μs, 0.11μs, 0.30μs, 0.12μs, 0.11μs, 0.11μs, 0.11μs, 0.11μs, 0.12μs, 0.11μs, 0.11μs, 0.13μs, 0.12μs, 0.12μs, 0.12μs, 0.11μs, 0.11μs, 0.11μs, 0.12μs, 0.12μs, 0.11μs, 0.14μs, 0.11μs, 4.54μs, 0.18μs, 0.19μs, 0.12μs, 0.19μs, 0.19μs]
add_rows -> avg: 100.00ns, executions: [100.00ns]
generate -> avg: 188.08ms, executions: [188.08ms]
add_row -> avg: 415.02ns, executions: [1.88μs, 0.45μs, 0.42μs, 0.29μs, 0.44μs, 0.24μs, 0.25μs, 0.22μs, 0.67μs, 0.23μs, 0.28μs, 0.22μs, 0.22μs, 0.22μs, 0.22μs, 0.22μs, 0.92μs, 0.22μs, 0.22μs, 0.23μs, 0.22μs, 0.21μs, 0.22μs, 0.40μs, 0.22μs, 0.22μs, 0.23μs, 0.22μs, 0.22μs, 0.23μs, 0.25μs, 0.22μs, 1.14μs, 0.22μs, 0.22μs, 0.22μs, 0.23μs, 0.22μs, 0.25μs, 0.24μs, 0.38μs, 0.29μs, 0.23μs, 0.22μs, 0.22μs, 0.22μs, 0.28μs, 0.32μs, 0.29μs, 0.30μs, 0.29μs, 0.33μs, 2.15μs, 0.50μs, 0.49μs, 0.32μs, 0.54μs, 0.31μs, 0.30μs, 0.30μs, 0.51μs, 0.29μs, 0.30μs, 0.22μs, 0.22μs, 0.25μs, 0.22μs, 0.25μs, 0.60μs, 0.31μs, 0.30μs, 0.22μs, 0.29μs, 0.22μs, 0.60μs, 0.21μs, 0.23μs, 0.22μs, 0.22μs, 0.23μs, 0.22μs, 0.22μs, 0.24μs, 0.22μs, 0.47μs, 0.23μs, 0.23μs, 0.23μs, 0.22μs, 0.21μs, 0.22μs, 0.22μs, 0.22μs, 0.35μs, 0.22μs, 0.22μs, 0.22μs, 0.33μs, 0.22μs, 0.22μs, 0.22μs, 0.30μs, 0.22μs, 0.28μs, 0.22μs, 10.32μs, 0.37μs, 0.37μs, 0.24μs, 0.38μs, 0.30μs]
add_rows -> avg: 161.00ns, executions: [161.00ns]
file_size -> 286.87Kb
4 changes: 2 additions & 2 deletions docs/assets/text/custompagev2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 2.17ms, executions: [2.17ms]
add_row -> avg: 1633.00ns, executions: [1.63μs]
generate -> avg: 3.96ms, executions: [3.96ms]
add_row -> avg: 2134.00ns, executions: [2.13μs]
file_size -> 205.16Kb
4 changes: 2 additions & 2 deletions docs/assets/text/datamatrixgridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 1.16ms, executions: [1.16ms]
add_row -> avg: 618.75ns, executions: [1.42μs, 0.42μs, 0.39μs, 0.24μs]
generate -> avg: 2.42ms, executions: [2.42ms]
add_row -> avg: 1197.50ns, executions: [2.60μs, 0.78μs, 0.77μs, 0.63μs]
file_size -> 4.58Kb
4 changes: 2 additions & 2 deletions docs/assets/text/disablepagebreakv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 264.65ms, executions: [264.65ms]
add_page -> avg: 762.00ns, executions: [762.00ns]
generate -> avg: 454.28ms, executions: [454.28ms]
add_page -> avg: 1814.00ns, executions: [1.81μs]
file_size -> 806.50Kb
6 changes: 3 additions & 3 deletions docs/assets/text/footerv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 21.94ms, executions: [21.94ms]
footer -> avg: 831.00ns, executions: [831.00ns]
add_rows -> avg: 165.54ns, executions: [0.32μs, 0.22μs, 0.26μs, 0.10μs, 0.26μs, 0.09μs, 0.07μs, 0.06μs, 0.27μs, 0.07μs, 0.06μs, 0.07μs, 0.07μs, 0.07μs, 0.06μs, 0.06μs, 0.99μs, 0.07μs, 0.07μs, 0.07μs, 0.06μs, 0.07μs, 0.06μs, 0.07μs, 1.49μs, 0.21μs, 0.19μs, 0.07μs, 0.18μs, 0.06μs, 0.05μs, 0.05μs, 0.19μs, 0.06μs, 0.05μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.06μs, 0.25μs, 0.05μs, 0.05μs, 0.05μs, 0.06μs, 0.07μs, 0.06μs, 0.06μs, 0.95μs, 0.19μs]
generate -> avg: 57.72ms, executions: [57.72ms]
footer -> avg: 1.34μs, executions: [1.34μs]
add_rows -> avg: 408.90ns, executions: [0.80μs, 0.44μs, 0.51μs, 0.15μs, 0.46μs, 0.14μs, 0.15μs, 0.11μs, 0.69μs, 0.11μs, 0.12μs, 0.12μs, 0.15μs, 0.12μs, 0.11μs, 0.11μs, 4.59μs, 0.12μs, 0.24μs, 0.14μs, 0.13μs, 0.11μs, 0.14μs, 0.12μs, 2.85μs, 0.48μs, 0.45μs, 0.14μs, 0.47μs, 0.14μs, 0.12μs, 0.12μs, 0.41μs, 0.12μs, 0.12μs, 0.13μs, 0.13μs, 0.12μs, 0.12μs, 0.14μs, 0.67μs, 0.12μs, 0.12μs, 0.11μs, 0.13μs, 0.16μs, 0.13μs, 0.12μs, 2.47μs, 0.46μs]
file_size -> 14.76Kb
6 changes: 3 additions & 3 deletions docs/assets/text/headerv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 39.44ms, executions: [39.44ms]
header -> avg: 1.23μs, executions: [1.23μs]
add_rows -> avg: 215.20ns, executions: [0.50μs, 0.27μs, 0.12μs, 0.31μs, 0.09μs, 0.09μs, 0.09μs, 0.35μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.08μs, 0.08μs, 1.49μs, 0.06μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 2.10μs, 0.24μs, 0.07μs, 0.30μs, 0.07μs, 0.07μs, 0.06μs, 0.29μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.31μs, 0.06μs, 0.06μs, 0.07μs, 0.06μs, 0.08μs, 0.08μs, 0.08μs, 0.07μs, 1.57μs, 0.24μs]
generate -> avg: 38.82ms, executions: [38.82ms]
header -> avg: 1.39μs, executions: [1.39μs]
add_rows -> avg: 506.06ns, executions: [0.82μs, 0.27μs, 0.10μs, 0.33μs, 0.10μs, 0.11μs, 0.09μs, 0.34μs, 0.08μs, 0.08μs, 0.09μs, 0.09μs, 0.08μs, 0.08μs, 0.09μs, 1.40μs, 0.09μs, 0.09μs, 0.08μs, 0.09μs, 0.09μs, 0.09μs, 0.08μs, 0.09μs, 2.10μs, 0.27μs, 0.09μs, 0.29μs, 0.08μs, 0.09μs, 0.08μs, 0.28μs, 0.08μs, 0.09μs, 0.08μs, 0.08μs, 0.08μs, 0.09μs, 0.08μs, 0.42μs, 0.09μs, 0.09μs, 0.08μs, 0.08μs, 0.09μs, 0.09μs, 0.09μs, 0.09μs, 15.12μs, 0.34μs]
file_size -> 14.75Kb
4 changes: 2 additions & 2 deletions docs/assets/text/imagegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 7.14ms, executions: [7.14ms]
add_row -> avg: 542.67ns, executions: [1.86μs, 0.33μs, 0.29μs, 0.25μs, 0.31μs, 0.21μs]
generate -> avg: 11.10ms, executions: [11.10ms]
add_row -> avg: 606.00ns, executions: [1.52μs, 0.48μs, 0.49μs, 0.31μs, 0.54μs, 0.29μs]
file_size -> 222.72Kb
4 changes: 2 additions & 2 deletions docs/assets/text/linegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 175.96μs, executions: [175.96μs]
add_row -> avg: 545.20ns, executions: [1.68μs, 0.32μs, 0.27μs, 0.19μs, 0.26μs]
generate -> avg: 948.67μs, executions: [948.67μs]
add_row -> avg: 845.40ns, executions: [1.72μs, 0.71μs, 0.60μs, 0.46μs, 0.73μs]
file_size -> 2.48Kb
4 changes: 2 additions & 2 deletions docs/assets/text/listv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 88.82ms, executions: [88.82ms]
add_rows -> avg: 3737.00ns, executions: [3.74μs]
generate -> avg: 247.87ms, executions: [247.87ms]
add_rows -> avg: 10871.00ns, executions: [10.87μs]
file_size -> 48.85Kb
4 changes: 2 additions & 2 deletions docs/assets/text/lowmemoryv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 9.48ms, executions: [9.48ms]
add_rows -> avg: 69.36ns, executions: [0.32μs, 0.09μs, 0.07μs, 0.03μs, 0.07μs, 0.02μs, 0.01μs, 0.02μs, 0.07μs, 0.02μs, 0.02μs, 0.01μs, 0.02μs, 0.02μs, 0.02μs, 0.01μs, 1.51μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.37μs, 0.08μs, 0.05μs, 0.02μs, 0.06μs, 0.02μs, 0.02μs, 0.02μs, 0.05μs, 0.01μs, 0.01μs, 0.02μs, 0.01μs, 0.02μs, 0.02μs, 0.02μs, 0.08μs, 0.02μs, 0.02μs, 0.02μs, 0.02μs, 0.01μs, 0.02μs, 0.02μs]
generate -> avg: 45.14ms, executions: [45.14ms]
add_rows -> avg: 218.12ns, executions: [1.36μs, 0.26μs, 0.25μs, 0.10μs, 0.26μs, 0.09μs, 0.09μs, 0.09μs, 0.38μs, 0.09μs, 0.07μs, 0.08μs, 0.07μs, 0.08μs, 0.08μs, 0.08μs, 2.48μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.08μs, 0.07μs, 0.07μs, 1.56μs, 0.23μs, 0.24μs, 0.07μs, 0.27μs, 0.07μs, 0.07μs, 0.07μs, 0.25μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.07μs, 0.48μs, 0.07μs, 0.07μs, 0.08μs, 0.08μs, 0.08μs, 0.08μs, 0.08μs]
file_size -> 2.52Kb
4 changes: 2 additions & 2 deletions docs/assets/text/marginsv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 451.78ms, executions: [451.78ms]
add_row -> avg: 1383.00ns, executions: [1.38μs]
generate -> avg: 605.72ms, executions: [605.72ms]
add_row -> avg: 1543.00ns, executions: [1.54μs]
file_size -> 253.43Kb
6 changes: 3 additions & 3 deletions docs/assets/text/maxgridsumv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 14.40ms, executions: [14.40ms]
add_row -> avg: 746.50ns, executions: [1.15μs, 0.34μs]
add_rows -> avg: 1102.00ns, executions: [1.10μs]
generate -> avg: 36.50ms, executions: [36.50ms]
add_row -> avg: 2935.50ns, executions: [4.82μs, 1.05μs]
add_rows -> avg: 1954.00ns, executions: [1.95μs]
file_size -> 8.13Kb
6 changes: 3 additions & 3 deletions docs/assets/text/mergepdfv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 22.46ms, executions: [22.46ms]
add_rows -> avg: 171.54ns, executions: [0.94μs, 0.16μs, 0.19μs, 0.07μs, 0.21μs, 0.06μs, 0.07μs, 0.06μs, 0.22μs, 0.07μs, 0.05μs, 0.05μs, 0.05μs, 1.71μs, 0.16μs, 0.16μs, 0.06μs, 0.18μs, 0.07μs, 0.05μs, 0.05μs, 0.19μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.69μs, 0.16μs, 0.15μs, 0.07μs, 0.18μs, 0.07μs, 0.05μs, 0.05μs, 0.18μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.68μs, 0.15μs, 0.16μs, 0.07μs, 0.18μs, 0.08μs, 0.05μs, 0.06μs, 0.19μs, 0.05μs, 0.06μs]
merge_pdf -> avg: 3.94ms, executions: [3.94ms]
generate -> avg: 62.34ms, executions: [62.34ms]
add_rows -> avg: 379.54ns, executions: [1.53μs, 0.31μs, 0.34μs, 0.14μs, 0.38μs, 0.10μs, 0.10μs, 0.10μs, 0.46μs, 0.11μs, 0.10μs, 0.10μs, 0.10μs, 4.50μs, 0.34μs, 0.31μs, 0.13μs, 0.36μs, 0.14μs, 0.11μs, 0.10μs, 0.47μs, 0.10μs, 0.10μs, 0.10μs, 0.10μs, 1.28μs, 0.31μs, 0.31μs, 0.11μs, 0.33μs, 0.11μs, 0.11μs, 0.11μs, 0.33μs, 0.10μs, 0.10μs, 0.10μs, 0.11μs, 1.27μs, 0.30μs, 0.31μs, 0.13μs, 0.40μs, 0.13μs, 0.11μs, 0.81μs, 1.08μs, 0.14μs, 0.13μs]
merge_pdf -> avg: 4.10ms, executions: [4.10ms]
file_size -> 280.85Kb
6 changes: 3 additions & 3 deletions docs/assets/text/metadatasv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 979.04μs, executions: [979.04μs]
add_rows -> avg: 1112.00ns, executions: [1.11μs]
file_size -> 1.30Kb
generate -> avg: 988.06μs, executions: [988.06μs]
add_rows -> avg: 1252.00ns, executions: [1.25μs]
file_size -> 1.32Kb
4 changes: 2 additions & 2 deletions docs/assets/text/orientationv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 602.08μs, executions: [602.08μs]
add_rows -> avg: 1032.00ns, executions: [1.03μs]
generate -> avg: 1.05ms, executions: [1.05ms]
add_rows -> avg: 1313.00ns, executions: [1.31μs]
file_size -> 1.29Kb
4 changes: 2 additions & 2 deletions docs/assets/text/pagenumberv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 9.24ms, executions: [9.24ms]
add_rows -> avg: 980.00ns, executions: [11.97μs, 0.15μs, 0.15μs, 0.05μs, 0.22μs, 0.05μs, 0.04μs, 0.04μs, 0.19μs, 0.04μs, 0.04μs, 0.04μs, 0.04μs, 1.53μs, 0.14μs]
generate -> avg: 24.14ms, executions: [24.14ms]
add_rows -> avg: 815.47ns, executions: [1.91μs, 0.52μs, 0.53μs, 0.15μs, 0.54μs, 0.15μs, 0.16μs, 0.13μs, 0.51μs, 0.15μs, 0.15μs, 0.15μs, 0.12μs, 6.55μs, 0.50μs]
file_size -> 5.50Kb
4 changes: 2 additions & 2 deletions docs/assets/text/parallelismv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 17.51ms, executions: [17.51ms]
add_rows -> avg: 163.14ns, executions: [1.68μs, 0.21μs, 0.21μs, 0.08μs, 0.23μs, 0.05μs, 0.06μs, 0.05μs, 0.24μs, 0.05μs, 0.05μs, 0.05μs, 0.04μs, 0.05μs, 0.05μs, 0.05μs, 1.45μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 1.26μs, 0.17μs, 0.18μs, 0.06μs, 0.19μs, 0.05μs, 0.04μs, 0.05μs, 0.19μs, 0.05μs, 0.05μs, 0.04μs, 0.05μs, 0.05μs, 0.04μs, 0.05μs, 0.22μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs, 0.05μs]
generate -> avg: 32.04ms, executions: [32.04ms]
add_rows -> avg: 348.18ns, executions: [1.39μs, 0.28μs, 0.26μs, 0.12μs, 0.33μs, 0.11μs, 0.10μs, 0.11μs, 0.37μs, 0.09μs, 0.09μs, 0.11μs, 0.09μs, 0.08μs, 0.08μs, 0.08μs, 8.02μs, 0.14μs, 0.08μs, 0.08μs, 0.08μs, 0.08μs, 0.08μs, 0.08μs, 0.08μs, 0.09μs, 1.93μs, 0.30μs, 0.26μs, 0.09μs, 0.32μs, 0.10μs, 0.08μs, 0.08μs, 0.28μs, 0.07μs, 0.08μs, 0.07μs, 0.08μs, 0.07μs, 0.08μs, 0.07μs, 0.34μs, 0.08μs, 0.07μs, 0.08μs, 0.09μs, 0.09μs, 0.11μs, 0.08μs]
file_size -> 2.52Kb
4 changes: 2 additions & 2 deletions docs/assets/text/protectionv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 1.31ms, executions: [1.31ms]
add_rows -> avg: 1473.00ns, executions: [1.47μs]
generate -> avg: 885.60μs, executions: [885.60μs]
add_rows -> avg: 1322.00ns, executions: [1.32μs]
file_size -> 1.42Kb
4 changes: 2 additions & 2 deletions docs/assets/text/qrgridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 2.99ms, executions: [2.99ms]
add_row -> avg: 521.25ns, executions: [1.28μs, 0.31μs, 0.29μs, 0.20μs]
generate -> avg: 6.85ms, executions: [6.85ms]
add_row -> avg: 881.50ns, executions: [1.91μs, 0.62μs, 0.58μs, 0.41μs]
file_size -> 4.65Kb
4 changes: 2 additions & 2 deletions docs/assets/text/signaturegridv2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
generate -> avg: 6.04ms, executions: [6.04ms]
add_row -> avg: 721.33ns, executions: [1.33μs, 0.46μs, 0.37μs]
generate -> avg: 8.37ms, executions: [8.37ms]
add_row -> avg: 665.00ns, executions: [1.13μs, 0.43μs, 0.43μs]
file_size -> 4.99Kb
6 changes: 3 additions & 3 deletions docs/assets/text/textgridv2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
generate -> avg: 10.30ms, executions: [10.30ms]
add_row -> avg: 433.00ns, executions: [1.24μs, 0.34μs, 0.19μs, 0.19μs, 0.20μs]
add_rows -> avg: 140.40ns, executions: [221.00ns, 180.00ns, 60.00ns, 181.00ns, 60.00ns]
generate -> avg: 21.04ms, executions: [21.04ms]
add_row -> avg: 675.40ns, executions: [2.01μs, 0.50μs, 0.30μs, 0.30μs, 0.26μs]
add_rows -> avg: 260.40ns, executions: [331.00ns, 301.00ns, 100.00ns, 470.00ns, 100.00ns]
file_size -> 8.74Kb
1 change: 1 addition & 0 deletions docs/v2/features/metadatas.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [builder : WithCreator](https://pkg.go.dev/github.com/johnfercher/maroto/v2/pkg/config#CfgBuilder.WithCreator)
* [builder : WithSubject](https://pkg.go.dev/github.com/johnfercher/maroto/v2/pkg/config#CfgBuilder.WithSubject)
* [builder : WithTitle](https://pkg.go.dev/github.com/johnfercher/maroto/v2/pkg/config#CfgBuilder.WithTitle)
* [builder : WithKeywords](https://pkg.go.dev/github.com/johnfercher/maroto/v2/pkg/config#CfgBuilder.WithKeywords)

## Code Example
[filename](../../assets/examples/metadatas/v2/main.go ':include :type=code')
Expand Down
4 changes: 4 additions & 0 deletions internal/providers/gofpdf/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ func (g *provider) SetMetadata(metadata *entity.Metadata) {
if metadata.CreationDate != nil {
g.fpdf.SetCreationDate(*metadata.CreationDate)
}

if metadata.KeywordsStr != nil {
g.fpdf.SetKeywords(metadata.KeywordsStr.Text, metadata.KeywordsStr.UTF8)
}
}

func (g *provider) GenerateBytes() ([]byte, error) {
Expand Down
6 changes: 6 additions & 0 deletions internal/providers/gofpdf/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ func TestProvider_SetMetadata(t *testing.T) {
fpdf.EXPECT().SetCreator("creator", true)
fpdf.EXPECT().SetSubject("subject", true)
fpdf.EXPECT().SetTitle("title", true)
fpdf.EXPECT().SetKeywords("keyword", true)
fpdf.EXPECT().SetCreationDate(timeNow)

dep := &gofpdf.Dependencies{
Expand All @@ -638,6 +639,10 @@ func TestProvider_SetMetadata(t *testing.T) {
Text: "title",
UTF8: true,
},
KeywordsStr: &entity.Utf8Text{
Text: "keyword",
UTF8: true,
},
CreationDate: &timeNow,
})

Expand All @@ -647,6 +652,7 @@ func TestProvider_SetMetadata(t *testing.T) {
fpdf.AssertNumberOfCalls(t, "SetSubject", 1)
fpdf.AssertNumberOfCalls(t, "SetTitle", 1)
fpdf.AssertNumberOfCalls(t, "SetCreationDate", 1)
fpdf.AssertNumberOfCalls(t, "SetKeywords", 1)
})
}

Expand Down
15 changes: 15 additions & 0 deletions pkg/config/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Builder interface {
WithCustomFonts([]*entity.CustomFont) Builder
WithBackgroundImage([]byte, extension.Type) Builder
WithDisableAutoPageBreak(disabled bool) Builder
WithKeywords(keywordsStr string, isUTF8 bool) Builder
Build() *entity.Config
}

Expand Down Expand Up @@ -91,6 +92,20 @@ func NewBuilder() Builder {
}
}

// Withkeywords defines the document's keyword metadata
func (b *CfgBuilder) WithKeywords(keywordsStr string, isUTF8 bool) Builder {
if keywordsStr == "" {
return b
}

b.metadata.KeywordsStr = &entity.Utf8Text{
Text: keywordsStr,
UTF8: isUTF8,
}

return b
}

// WithPageSize defines the page size, ex: A4, A4 and etc.
func (b *CfgBuilder) WithPageSize(size pagesize.Type) Builder {
if size == "" {
Expand Down
24 changes: 24 additions & 0 deletions pkg/config/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,30 @@ func TestBuilder_WithAuthor(t *testing.T) {
})
}

func TestBuilder_WithKeywords(t *testing.T) {
t.Run("when keywords is empty, should ignore", func(t *testing.T) {
// Arrange
sut := config.NewBuilder()

// Act
cfg := sut.WithKeywords("", true).Build()

// Assert
assert.Nil(t, cfg.Metadata.KeywordsStr)
})
t.Run("when author valid, should apply", func(t *testing.T) {
// Arrange
sut := config.NewBuilder()

// Act
cfg := sut.WithKeywords("keyword", true).Build()

// Assert
assert.Equal(t, "keyword", cfg.Metadata.KeywordsStr.Text)
assert.Equal(t, true, cfg.Metadata.KeywordsStr.UTF8)
})
}

func TestBuilder_WithCreator(t *testing.T) {
t.Run("when creator is empty, should ignore", func(t *testing.T) {
// Arrange
Expand Down
1 change: 1 addition & 0 deletions pkg/core/entity/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestConfig_ToMap(t *testing.T) {
assert.Equal(t, "Utf8Text(creator, false)", m["config_metadata_creator"])
assert.Equal(t, "Utf8Text(subject, true)", m["config_metadata_subject"])
assert.Equal(t, "Utf8Text(title, true)", m["config_metadata_title"])
assert.Equal(t, "Utf8Text(keyword, true)", m["config_metadata_keywords"])
assert.Equal(t, true, m["config_metadata_creation_date"])
assert.Equal(t, "[1 2 3]", m["entity_image_bytes"])
assert.Equal(t, extension.Png, m["entity_extension"])
Expand Down
5 changes: 5 additions & 0 deletions pkg/core/entity/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Metadata struct {
Subject *Utf8Text
Title *Utf8Text
CreationDate *time.Time
KeywordsStr *Utf8Text
}

// AppendMap appends the metadata to a map.
Expand All @@ -36,6 +37,10 @@ func (m *Metadata) AppendMap(mp map[string]interface{}) map[string]interface{} {
mp["config_metadata_creation_date"] = true
}

if m.KeywordsStr != nil {
mp["config_metadata_keywords"] = m.KeywordsStr.ToString()
}

return mp
}

Expand Down
Loading
Loading