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

A

Aqua

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.
 
E

Eric

Aqua said:
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.
 
K

Kyler Laird

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()
 
R

Richard Morse

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
 
A

Aqua

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
 
A

Aqua

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
 
R

Richard Morse

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)[/QUOTE]

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
 
A

Aqua

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top