Re: Change JPG images to fit into an A4 PDF page

Anthony Thyssen <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <20091126105437.4d547ea3@wraith>
On Wed, 25 Nov 2009 21:51:29 +0100
Sebastian Krause <[email protected]> wrote:

| Anthony Thyssen <[email protected]> wrote:
| > I have added this to the notes in IM examples, File Formats, PDF
| >   http://www.imagemagick.org/Usage/formats/#pdf_alturnatives
| >
| > Question can that perl script 'fix' a PDF that IM generated, or is it
| > restricted to PDF's created by sam2p??
| 
| Unfortunately it doesn't work with default PDFs created by IM, you
| get the following error:
| 
| $ sam2p_pdf_scale.pl 595 842 test.pdf
| sam2p PDF syntax error (no cm)
| 
| Now I'm not really familiar with the internal file structure of PDF,
| but the beginning of a 640x400 PNG converted by sam2p looks like
| this:
| 
| ,----
| | %PDF-1.2
| | %Çì<8f>¢
| | 2 0 obj
| | <</Type/Pages/Kids[4 0 R]/Count 1>>
| | endobj
| | 3 0 obj
| | <</Length 1565>>
| | stream
| | q
| | 640 0 0 400 0 0 cm
| | BI/Interpolate false/W 640/H 400/CS/DeviceGray /BPC 8/F/Fl ID
| | [...]
| `----
| 
| The second to last line is what the script is looking for:
| 
| ,----[ sam2p_pdf_scale.pl ]
| | die "sam2p PDF syntax error (no cm)\n" if $S!~m@\n((\d+) 0 0 (\d+) 0 0 cm\b)@g;
| `----
| 
| Now if we could somehow tell IM to store the units this way, the
| script might work on those PDFs as well.
| 

Or have IM incorporate the -page option (or a specific 'coder' -define)
so users don't have so much trouble with PDF (and PS) pages of images.


  Anthony Thyssen ( System Programmer )    <[email protected]>
 --------------------------------------------------------------------------
   "All I can say is, enthusaim, sincerity, genine compassion, humour, can
   carry you through any lack of experence with... higher numerical values!"
          -- Ivoniva's Theory of Relationships,   Babalon 5, "Sic Transit Vir"
 --------------------------------------------------------------------------
     Anthony's Castle     http://hobbit.ict.griffith.edu.au/~anthony/

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.