Solved

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

Posted on 2004-09-03
7
1,512 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a previous article published here at Experts Exchange, Signature Image with Transparent Background (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_12380-Signature-Image-with-Transparent-Background.html), I explained how to cre…
In a previously published article (http://www.experts-exchange.com/articles/10331/Automatic-Duplex-Scanning-in-PaperPort-Versions-11-12-14.html) here at Experts Exchange, I explained how to achieve duplex (double-sided) scanning in Nuance's PaperPor…
This video is the first in a two-part series that discusses PaperPort's "Send To Bar" feature . This first video tutorial explains the purpose of the Send To Bar, how to use it, and how to hide unwanted items that are automatically created on it whe…
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…

911 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

15 Experts available now in Live!

Get 1:1 Help Now