Solved

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

Posted on 2004-09-03
7
1,502 Views
Last Modified: 2013-12-02
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
0
Comment
Question by:lword
  • 5
7 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 250 total points
ID: 11972065
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
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11979695
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
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11979737
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
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11979801
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
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12005101
Any luck?
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Adobe Reader DC will not die 9 68
Google Groups 6 70
Need graphics tool to create card game 2 82
Editing PDF using MAC OS X 3 50
PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles a…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now