http://www.perlmonks.org?node_id=889498

ksublondie has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!

I've created a dynamic postscript document with PostScript::Simple and am able to successfully create a pdf using PostScript::Convert and/or by opening the ps document in Adobe.

However, when I attempt to import an EPS logo, I get the following errors when running my perl script:

Ghostscript failed: exit status 1 at /usr/local/share/perl/5.10.0/Post +Script/Convert.pm line 302 PostScript::Convert::convert_fh('File::Temp=GLOB(0x9dd3c00)', 'HASH(0x +9beda00)') called at /usr/local/share/perl/5.10.0/PostScript/Convert. +pm line 186 PostScript::Convert::convert_ref('SCALAR(0x9dce118)', 'HASH(0x9beda00) +') called at /usr/local/share/perl/5.10.0/PostScript/Convert.pm line +87 PostScript::Convert::psconvert('SCALAR(0x9dce118)', 'filename', 'fileB +53331AF-6526-8804-3B37-68F2EFC8F14A.pdf', 'format', 'pdf') called at +/var/www/perl/modules/Intranet/FirstFarm/Printing.pm line 159
...and when I try to open the ps file through Adobe, I get the following errors in the dialog box:
Acrobat Distiller 8.0 Started: Monday, February 21, 2011 at 16:33:43 Adobe PostScript software version: 3016.102 CID support library initialization completed. Error in PDFX4 2007.joboptions: /CheckCompliance out of range Start Time: Monday, February 21, 2011 at 16:34:08 Source: fileB53331AF-6526-8804-3B37-68F2EFC8F14A.ps Destination: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\scp32583\fileB53331AF- +6526-8804-3B37-68F2EFC8F14A.pdf Adobe PDF Settings: C:\Documents and Settings\All Users\Application Da +ta\Adobe\Adobe PDF\Settings\Standard.joboptions %%[ Error: undefined; OffendingCommand: ÅÐÓÆ ]%% %%[ Flushing: rest of job (to end-of-file) will be ignored ]%% %%[ Warning: PostScript error. No PDF file produced. ] %% Distill Time: 00 Hour(s) : 00 Minute(s) : 00.109 Second(s) **** End of Job ****
So I'm assuming there is nothing wrong with my GS installation if Adobe is having issues as well.

I've tried importing a blank EPS file created w/Illustrator along with several different EPS files all with the same result. The only concusion I can come up with is that either all my EPS files are jacked or there's something wrong with my perl, but since I've followed the documentation on how to import the EPS, I'm at a loss.

Here's my perl code:

my $ps = new PostScript::Simple(papersize => "Letter", colour => 1, eps => 0, units => "pt"); $ps->newpage; $ps->setcolour("black"); $ps->setlinewidth( 1 ); #I've tried both of the following methods #my $image = new PostScript::Simple::EPS(file => "test2.eps"); #$ps->importeps( $image, 300,300) ; $ps->importepsfile( "test.eps", 5,1,6,6) ; ... #$Id is set in the sub parameters $ps->output("file$Id.ps"); my $text=$ps->get; psconvert(\$text,filename=>"file$Id.pdf",format=>'pdf');
Does anyone have any ideas on how I can get this to work?

Replies are listed 'Best First'.
Re: Problems adding EPS file to PostScript::Simple
by Eliya (Vicar) on Feb 22, 2011 at 00:05 UTC
    %%[ Error: undefined; OffendingCommand: ÅÐÓÆ ]%%

    The "offending command" ÅÐÓÆ (C5 D0 D3 C6 in hex) is the typical identifying characteristic of an EPS file containing a TIFF/WMF preview thumbnail (see Identifying EPS files).

    Not all tools can handle such extended EPS files correctly, so the above ID may end up being mistakenly interpreted as a Postscript command.  You could try either creating the EPS file(s) anew without a preview image, or use something like epstool to extract the pure-EPS content from your existing EPS files.

      Perfect! Finally got it to work. Thanks!