URGENT !!!!!! Embedding eps file into pdf

Hi everybody,

Am trying to embed an eps file into a pdf file.
When i try to load my pdf document it says, "file damaged.could not be repaired"

I want to solve this problem ASAP.Please help me in solving this issue.

Following is the pdf code :
---------------- CODE -----------------

%PDF-1.3
%âãÏÓ

1 0 obj
<< /Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R >>
endobj


2 0 obj
<< /Type /Outlines /Count 0 >>
endobj

3 0 obj
<< /Type /Pages
/Kids [6 0 R
]
/Count 1
/Resources <<
/ProcSet 4 0 R
/XObject << 
/PS1 8 0 R >>
>>
/MediaBox [0.000 0.000 595.280 841.890]
 >>
endobj

4 0 obj
[/PDF /Text /ImageC ]
endobj

5 0 obj
<<
/Creator (R and OS php pdf writer, http://www.ros.co.nz)
/CreationDate (D:20040903)
>>
endobj

6 0 obj
<< /Type /Page
/Parent 3 0 R
/Contents 7 0 R
>>
endobj


7 0 obj
<< /Length 39 >>
stream
/PS1 Do
endstream
endobj

8 0 obj  <<
/Length 7989
/Type /XObject
/Subtype /PS
>>
stream

%!PS-Adobe-3.1 EPSF-3.0
%%Title: TextA.eps
%%Creator: Adobe Illustrator(R) X
%%AI8_CreatorVersion: 10.0%AI9_PrintingDataBegin%%For: LW
%%CreationDate: 9/3/2004
%%BoundingBox: 0 0 75 38

endstream
endobj

xref
0 9
0000000000 65535 f
0000000015 00000 n
0000000080 00000 n
0000000126 00000 n
0000000283 00000 n
0000000320 00000 n
0000000425 00000 n
0000000488 00000 n
0000000599 00000 n

trailer
  << /Size 9
     /Root 1 0 R
     /Info 5 0 R
  >>
startxref
2226
%%EOF
-----------------------------------------------

Awaiting your solution

Thanks in advance

Cheers
prasanna
lwordAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Karl Heinz KremerConnect With a Mentor Commented:
The error message you quoted is usually caused by a corrupt xref table. It's impossible to verify the table with the data you've posted: PDF is a binary format, and when you embed it as a text file, it's no longer useful. Can you make this file available on the web somehow?

How are you embedding the EPS? And why?
Embedded PostScript is only supported by PostScript devices (e.g. a printer), and I doubt that it will work in e.g. Acrobat. The general recommendation is to not use embedded PostScript, because your otherwise platform independent PDF file will become platform dependent (e.g. it will only work on PostScript devices).

I see your EPS file was created by Illustrator, you can also export PDF from Illustrator and then bring this into your PDF file.

Also, without looking any deeper into your PDF file, I doubt that it would work (even with a PostScript printer) because you are not setting a transformation matrix before you place the EPS content.
0
 
Karl Heinz KremerCommented:
Here is information from the PDF Reference (v1.5, section 7.1):

"A PostScript XObject (Section 4.7.1, “PostScript XObjects”) contains a fragment
of code expressed in the PostScript page description language. PostScript XObjects
are no longer recommended to be used."

and from section 7.1.1:

"Note: Since PDF 1.4 encompasses all of the Adobe imaging model features of the
PostScript language, there is no longer any reason to use PostScript XObjects. This
feature is likely to be removed from PDF in a future version."

This chapter contains more information that advises against using PostScript XObjects.
0
 
Karl Heinz KremerCommented:
OK, I took your file and saved it as a text file, then I used a tool that prints the byte offset for every line and fixed the xref table. One thing that is definitely wrong is your offset to the xref table (startxref): 2226 is definitely wrong if object 8 is at offset 599.

You should use other tools than Acrobat (or Reader) to debug your PDF files. xpdf for example gives much more useful error messages (as does Ghostscript). Once I had the xref table fixed, I got the following error message from xpdf:

Error (577): Missing 'endstream'
Error: Missing 'endstream'
Error (555): Unknown operator 'endstream'
Error (557): Unknown operator 'endobj'
Error (572): Unknown operator 'obj'
Error: Missing 'endstream'
Error: Leftover args in content stream

As you can see, you get a byte offset, and the associated error. It looks like something is wrong with the PS stream that you've embedded.  

Here is the error message reported by Ghostscript:

gs ./test.pdf
ESP Ghostscript 7.07 (2003-07-12)
Copyright 2003 artofcode LLC and Easy Software Products, all rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
Processing pages 1 through 1.
Page 1
Error: /syntaxerror in stream
Operand stack:
   --dict:3/3(L)--   1072   7   0   --dict:3/3(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1057/1417(ro)(G)--   --dict:0/20(G)--   --dict:73/200(L)--   --dict:73/200(L)--   --dict:97/127(ro)(G)--   --dict:229/230(ro)(G)--   --dict:19/24(L)--   --dict:4/6(L)--   --dict:19/20(L)--
Current allocation mode is local
ESP Ghostscript 7.07.1: Unrecoverable error, exit code 1


The most important part is right at the beginning: syntax error in stream.


0
 
Karl Heinz KremerCommented:
I suspect hat you removed information from the file (e.g. the actual EPS content). The content length of the EPS stream does however still not match the startxref information. I was able to open the file by changing the two stream lengths (the page content and the PS xobject) to respectively 8 and 126

It's important that you understand what the Length entry in the stream object is. The PDF Reference contains the definition. It's the length of the actual stream (regardless of any compression applied, so for uncompressed data it's the length of the uncompressed data, and for compressed data it's the length of the _COMPRESSED_ data). It's the number of bytes from the first character of the line following the "stream" keyword until the last byte before the "endstream" keyword (including any line terminators).

It's usually best to but "Length" information into a separate object that you reference from the stream object, but write out after the stream object. This way, you can just take the locations in the file reported by seek() and subtract them (minus 1).  
0
 
Karl Heinz KremerCommented:
Any luck?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.