Fixing margin left.

This commit is contained in:
Sergiotarxz 2024-05-23 13:13:28 +02:00
parent 247cb3cbfd
commit bb0b48dc2f
1 changed files with 7 additions and 2 deletions

View File

@ -90,7 +90,8 @@ sub _generate_pdf ( $self, $cards, $images ) {
my $page = $pdf->page; my $page = $pdf->page;
$page->size('A4'); $page->size('A4');
my @rectangle = $page->size; my @rectangle = $page->size;
my $n_pixels_per_cm = $rectangle[2] / 21.0; my $width_paper = $rectangle[2];
my $n_pixels_per_cm = $width_paper / 21.0;
for my $card (@$cards) { for my $card (@$cards) {
my $images_card = $images->{ $card->{scryfallId} }; my $images_card = $images->{ $card->{scryfallId} };
for my $image_kind ( keys %$images_card ) { for my $image_kind ( keys %$images_card ) {
@ -100,11 +101,15 @@ sub _generate_pdf ( $self, $cards, $images ) {
$page = $pdf->page; $page = $pdf->page;
$page->size('A4'); $page->size('A4');
} }
my $margin_left = 25;
my $margin_bottom = 25; my $margin_bottom = 25;
my $mtg_card_width = 6.35; my $mtg_card_width = 6.35;
my $mtg_card_height = 8.89; my $mtg_card_height = 8.89;
my $small_line_to_cut_better_size = 0.5; my $small_line_to_cut_better_size = 0.5;
my $margin_left = (
$width_paper
- ($mtg_card_width * 3)
- ($small_line_to_cut_better_size * 2)
) / 2;
open my $fh, '<', \$images_card->{$image_kind}; open my $fh, '<', \$images_card->{$image_kind};
my $image = $pdf->image( $fh, format => 'jpeg' ); my $image = $pdf->image( $fh, format => 'jpeg' );
my $page_position_x = $number_image % 3; my $page_position_x = $number_image % 3;