How can I create a PDF page with only Images (EPS & TIFF)

Discussion in 'Perl Misc' started by Aqua, Apr 26, 2004.

  1. Aqua

    Aqua Guest

    Hello Group,

    I have lot of EPS and TIFF images that needs to be manually verified.
    So I wanted to create a PDF with those images.

    I appreciate any help in this regard.

    Regards
    Dominic

    System: Windows 2000
    Packages available: Perl 5.8, Image magick and Ghost Script.
     
    Aqua, Apr 26, 2004
    #1
    1. Advertising

  2. Aqua

    Eric Guest

    Aqua wrote:

    > Hello Group,
    >
    > I have lot of EPS and TIFF images that needs to be manually verified.
    > So I wanted to create a PDF with those images.


    The simple way is to make a document with all the images included and then
    run out the PS and use GS to make the PDF.

    The document that you use depends on your skill. Either use Quark or
    Pagemaker with some scripting to include the images into your document.

    Or you could use LaTeX: create a galley using perl and then runout.

    Or you could write manual PostScript using Perl. This would require some
    work, but then it would be quite portable.


    Eric.
     
    Eric, Apr 26, 2004
    #2
    1. Advertising

  3. Aqua

    JRB Guest

    JRB, Apr 26, 2004
    #3
  4. Aqua

    Kyler Laird Guest

    (Aqua) writes:

    >I have lot of EPS and TIFF images that needs to be manually verified.
    >So I wanted to create a PDF with those images.


    I recently learned to do this with iText as a first step toward another
    goal. My code follows.

    >System: Windows 2000
    >Packages available: Perl 5.8, Image magick and Ghost Script.


    I don't know of any reason you shouldn't be able to install iText
    http://www.lowagie.com/iText/
    and Jython
    http://www.jython.org/
    on such a system.

    --kyler

    ========================================================================
    #!/usr/bin/env jython

    import sys
    sys.path.append('/usr/share/java/itext.jar')
    import com.lowagie
    import java

    document = com.lowagie.text.Document(
    com.lowagie.text.PageSize.LETTER.rotate(),
    page_size,
    0, 0, 0, 0
    )

    com.lowagie.text.pdf.PdfWriter.getInstance(document, java.io.FileOutputStream('foo.pdf'));

    document.open()

    image_filenames = [
    '/home/kyler/common/images/disk0022/img_1279.jpg',
    '/home/kyler/common/images/disk0022/img_1284.jpg',
    '/home/kyler/common/images/disk0022/img_1304.jpg',
    ]

    width = document.getPageSize().width()
    height = document.getPageSize().height()

    for image_filename in image_filenames:
    print 'adding %s' % (image_filename)
    image = com.lowagie.text.Image.getInstance(image_filename)
    #image.scalePercent(40)
    image.scaleToFit(width, height)
    document.add(image)

    document.close()
     
    Kyler Laird, Apr 26, 2004
    #4
  5. In article <>,
    (Aqua) wrote:

    > Hello Group,
    >
    > I have lot of EPS and TIFF images that needs to be manually verified.
    > So I wanted to create a PDF with those images.
    >
    > I appreciate any help in this regard.
    >
    > System: Windows 2000
    > Packages available: Perl 5.8, Image magick and Ghost Script.


    Can you install PDF::API2?

    This should allow you to create a PDF with all the images...

    HTH,
    Ricky

    --
    Pukku
     
    Richard Morse, Apr 26, 2004
    #5
  6. Aqua

    Aqua Guest

    > Can you install PDF::API2?
    >
    > This should allow you to create a PDF with all the images...
    >
    > HTH,
    > Ricky


    I am conversant with Perl. So I have already tried PDF::API2.
    use PDF::API2;

    unlink "test.pdf";
    $pdf = PDF::API2->new(-file=>"test.pdf");
    $page = $pdf->page(1);
    $gfx = $page->gfx;
    $img = $pdf->image_tiff("bbb.tif");
    #$img = $pdf->image_jpeg("ccc.jpg");
    $gfx->image($img, 0, 0);
    $page->update;
    $pdf->update;

    exit;

    The above sample doesnt create a PDF (or it creates a PDF but I am not
    able to open it)

    Regards
    Dominic
     
    Aqua, Apr 27, 2004
    #6
  7. Aqua

    Aqua Guest

    > The simple way is to make a document with all the images included and then
    > run out the PS and use GS to make the PDF.
    >
    > The document that you use depends on your skill. Either use Quark or
    > Pagemaker with some scripting to include the images into your document.


    I dont have Quark, but I have PM. Though I am familar with PM
    scripting, I can give it a try.

    > Or you could use LaTeX: create a galley using perl and then runout.
    > Or you could write manual PostScript using Perl. This would require some
    > work, but then it would be quite portable.


    I am conversant with perl but I am not familar with Latex. But I can
    try if it works. Appreciate any pointers.

    Thanks and Regards
    Dominic
     
    Aqua, Apr 27, 2004
    #7
  8. In article <>,
    (Aqua) wrote:

    > > Can you install PDF::API2?
    > >
    > > This should allow you to create a PDF with all the images...
    > >
    > > HTH,
    > > Ricky

    >
    > I am conversant with Perl. So I have already tried PDF::API2.
    > use PDF::API2;
    >
    > unlink "test.pdf";
    > $pdf = PDF::API2->new(-file=>"test.pdf");
    > $page = $pdf->page(1);
    > $gfx = $page->gfx;
    > $img = $pdf->image_tiff("bbb.tif");
    > #$img = $pdf->image_jpeg("ccc.jpg");
    > $gfx->image($img, 0, 0);
    > $page->update;
    > $pdf->update;
    >
    > exit;
    >
    > The above sample doesnt create a PDF (or it creates a PDF but I am not
    > able to open it)


    What happens if you do the following:

    #!/usr/bin/perl
    use strict;
    use warnings;

    use PDF::API2;

    my $pdf = PDF::API2->new();
    my $page = $pdf->page();
    $page->mediabox('LETTER');
    my $gfx = $page->gfx();
    $gfx->image($pdf->image_jpeg("/path/to/some/jpg"), 100, 100);
    $gfx->circle(50, 50, 10);
    $gfx->stroke();

    $pdf->saveas("/path/to/save/as");

    __END__

    Ricky

    --
    Pukku
     
    Richard Morse, Apr 27, 2004
    #8
  9. Aqua

    Aqua Guest

    > What happens if you do the following:
    >
    > #!/usr/bin/perl
    > use strict;
    > use warnings;
    >
    > use PDF::API2;
    >
    > my $pdf = PDF::API2->new();
    > my $page = $pdf->page();
    > $page->mediabox('LETTER');
    > my $gfx = $page->gfx();
    > $gfx->image($pdf->image_jpeg("/path/to/some/jpg"), 100, 100);
    > $gfx->circle(50, 50, 10);
    > $gfx->stroke();
    >
    > $pdf->saveas("/path/to/save/as");
    >
    > __END__


    This works for uncompressed TIFF.

    In case of PDF images I use
    $gfx->image($pdf->pdfimage("/path/to/some/pdf"), 100, 100);
    and the output PDF is not viewable.

    I tried PDF::Reuse and it works on PDF's. So temporarly I might
    convert my images into PDF and use "Reuse" like

    use PDF::Reuse;
    use strict;

    prFile('ex13.pdf');
    prForm( {file => 'gr1.pdf',
    x => 20,
    y => 720});
    prText(100, 500, 'This is put on the first page');
    #prPage();
    prForm('gr4.pdf');

    prEnd();

    BTW I wanted to try the same through Latex too.

    Thanks and Regards
    Dominic
     
    Aqua, Apr 28, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ather Ali Shaikh
    Replies:
    1
    Views:
    2,872
    ASP.Confused
    Jul 23, 2004
  2. Johan Holst Nielsen

    Analyse of PDF (or EPS?)

    Johan Holst Nielsen, Nov 20, 2003, in forum: Python
    Replies:
    13
    Views:
    703
    David Boddie
    Nov 25, 2003
  3. amit gupta

    EPS Tiff Preview

    amit gupta, Aug 11, 2006, in forum: C++
    Replies:
    1
    Views:
    1,228
    mlimber
    Aug 11, 2006
  4. Ricardo Pog
    Replies:
    1
    Views:
    470
    Austin Ziegler
    Mar 26, 2008
  5. ifiaz
    Replies:
    1
    Views:
    1,004
    Martien Verbruggen
    Nov 19, 2003
Loading...

Share This Page