1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| #!/usr/bin/perl
use strict;
use warnings;
use Image::Magick;
use PDF::API2;
use PDF::API2::Resource::ColorSpace::Separation;
use PDF::API2::Resource::ColorSpace::DeviceN;
my($image, $x);
$image = Image::Magick->new;
$x = $image->Read('logo.jpg');
$image->Crop(geometry=>'1900x1300+0+0');
$image->Set(colorspace=>'CMYK');
$image->Set(density=>'300x300');
$x =$image->Write('x.jpg');
my $pdf=PDF::API2->new;
my $cy = $pdf->colorspace_separation('Cyan', '%f000');
my $ma = $pdf->colorspace_separation('Magenta', '%0f00');
my $ye = $pdf->colorspace_separation('Yellow', '%00f0');
my $bk = $pdf->colorspace_separation('Black', '%000f');
my $pms023 = $pdf->colorspace_separation('PANTONE 032CV', '%0ff0');
my $dncs = $pdf->colorspace_devicen( [ $cy,$ma,$ye,$bk,$pms023 ] );
#$pdf->resource('ColorSpace',$spacekey,$spaceobj);//ne sais pas comment l'ecrire ni s'il faut s'en servir
my $page = $pdf->page;
$page->mediabox(1900,1300);
my $gfx=$page->gfx;
my $img = $pdf->image_jpeg("x.jpg");
$gfx->image($img, 0, 0, 1900,1300);
$pdf->saveas("test.pdf");
$pdf->end(); |
Partager