🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.postscript.programming
16 messages
16 total messages Started by Tim_Radle Fri, 20 Feb 2004 20:03
Embedding Metadata - Need Some Help.
#667
Author: Tim_Radle
Date: Fri, 20 Feb 2004 20:03
29 lines
2657 bytes
I'm a PostScript Language newbie, and need some quick help. According to the Adobe XMP Specification, the below code will insert metadata into PostScript files. What I don't know - is once I write this code, what do I use (and how) to process the code and get the metadata that's defined into the target PostScript file? I assume that I have a few syntax errors - any help you could offer would be more than appreciated.
Thanks!

/currentdistillerparams where
{pop currentdistillerparams /CoreDistVersion get 5000 lt} {true} ifelse

{newdict /pdfmark / cleartomark load put
	newdict /metafile_pdfmark {flushfile cleartomark} bind put}
{newdict /metafile_pdfmark {/PUT pdfmark} ifelse

%Define the stream object and associate it as metadata
[/_objdef {ncb_metadata_stream} /type /stream /OBJ pdfmark
[{ncb_metadata_stream} 2 dict begin
	/Type /Metadata def /Subtype /XML def currentdict end /PUT pdfmark

%Fill the stream with the XMP Packet...
[{ncb_metadata_stream}
	currentfile 0 (% &&end XMP packet marker&&)
	/SubFileDecode filter metafile_pdfmark

<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='817'?><rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'><rdf:Description about='' xmlns='http://ns.adobe.com/pdf/1.3/' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:Author='Advertising Dept' pdf:Creator='Adobe Illustrator(R) X' pdf:Title='New logo.star.ai'/>
<rdf:Description about='' xmlns='http://ns.adobe.com/xap/1.0/' xmlns:xap='http://ns.adobe.com/xap/1.0/' xap:Author='Advertising Dept'><xap:Title><rdf:Alt><rdf:li xml:lang='x-default'>New logo.star.ai</rdf:li></rdf:Alt></xap:Title></rdf:Description>
<rdf:Description about='' xmlns='http://purl.org/dc/elements/1.1/' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:creator='Advertising Dept' dc:title='New logo.star.ai'/>
</rdf:RDF><?xpacket end='r'?>

% &&end XMP packet marker&&

%Attach the stream as the main XMP metadata stream
[{Catalog} {ncb_metadata_stream} /Metadata pdfmark
Re: Embedding Metadata - Need Some Help.
#668
Author: Aandi_Inston
Date: Fri, 20 Feb 2004 20:24
8 lines
1031 bytes
I'm not sure I understand the question, but perhaps it's because you
are trying to do something this isn't intended to do.

The only purpuse of the commands you've added is to communicate with
Acrobat Distiller; it isn't really PostScript metadata, it's used to
make PDF metadata.

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#669
Author: Tim_Radle
Date: Fri, 20 Feb 2004 21:59
8 lines
1139 bytes
Aandi,

Is there a way to embed document metadata into the PostScript file directly, as set forth in the XMP Specification dated January 2004? The code that I've posted basically came directly out of the spec, on pages 86-87.

Thanks for your feedback! I very much appreciate your quick response. I've been wrestling with this for a few weeks now, and have yet to receive a response from the XMP team.

Regards,
Tim
Re: Embedding Metadata - Need Some Help.
#671
Author: Aandi_Inston
Date: Sat, 21 Feb 2004 13:42
9 lines
1202 bytes
>Is there a way to embed document metadata into the PostScript file directly, as set forth in the XMP Specification dated January 2004? 
>The code that I've posted basically came directly out of the spec, on pages 86-87.

That's what it is, metadata in the PostScript, for the purposes of
distilling to PDF. I don't really understand what alternative need you
are trying to meet.  Surely you aren't posting PostScript as a final
format?

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#670
Author: Aandi_Inston
Date: Sat, 21 Feb 2004 13:57
13 lines
1230 bytes
Having looked at the XMP Specification, I'm surprised to find that
PostScript IS a supported application file format.

In which case - well, the example is serving two purposes, cleverly:
1. It provides a home for the metadata in the PostScript which won't
cause an error (since just dumping XML into PostScript would be an
error by itself).
2. It provides a transparent way to carry said metadata into a PDF if
you distill.

So, you have what you seek. Right?

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#672
Author: Tim_Radle
Date: Sun, 22 Feb 2004 14:26
8 lines
1608 bytes
Aandi,

Essentially, I'm adding tracing data using XMP for the purpose of automation. That's why I need to add the metadata directly to PostScript. What isn't clear to me is how to manipulate the code in the XMP spec such that the XMP packet is actually embedded into the PostScript file. I know that if I first post the metadata to PDF and then print to PostScript, the metadata lives in the header of the file. I actually concatenate many documents into one large file, so according to the vendor that will be reading this data, that isn't an option. I actually need to embed the metadata in the body of the document itself.

Obviously when I distill, a PDF is generated. Can you please tell me what I need to do to get the code into the PostScript document itself using XMP? This obviously highlights my inexperience with PostScript programming, so please forgive my inept ability to resolve this given your most recent posts.

Thanks so much for your help!
Tim
Re: Embedding Metadata - Need Some Help.
#673
Author: Aandi_Inston
Date: Sun, 22 Feb 2004 15:49
16 lines
1218 bytes
So really the question is: I have this code, how do I add it to the
file?

There are three different answers to this, as the XMP specification
hints: depends on whether you are dealing with EPS, with DSC
PostScript, or with arbitrary PostScript.

Which is it?  

If you aren't sure, what is the very first line of the PostScript file
as viewed in a text editor?

Is this PostScript made by an application you maintain, or is created
by another "black box" application?

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#674
Author: Tim_Radle
Date: Mon, 23 Feb 2004 13:39
10 lines
1141 bytes
Aandi,

Thanks so much for sticking with me through this. If you're an Adobe employee, please give me the name of your boss such that I can sing your praises to him/her.

%!PS-Adobe-3.0 - This is the first line of the .ps files that we create. The documents are made by an application that basically just calls a simple print routine and passes the .pdf documents that are also created through a generic postscript printer.

Again, thank you so much. This is very much appreciated.

Regards,
Tim
Re: Embedding Metadata - Need Some Help.
#676
Author: Aandi_Inston
Date: Mon, 23 Feb 2004 14:09
14 lines
1339 bytes
Ok, that means the documents are DSC compliant. DSC is a set of
comments in the file that give information about the file, but are not
used in printing (usually).

You have two choices:
1. Add your lines maintaining the DSC compliance. To do that you need
to choose carefully where to add them. Perhaps before %%EndSetup if it
is present. I believe the XMP Reference defines DSC comments for this
metadata section.
2. Break the DSC compliance, which allows you to add the lines
anywhere they are legal in PostScript e.g. before the first line. If
you break DSC, set the first line to just %!

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#675
Author: Tim_Radle
Date: Mon, 23 Feb 2004 14:16
1 lines
1153 bytes
Do I understand you correctly that I simply copy the code directly into the .ps file? And, is there a unique set of code that is assigned to the "first line"? Our vendor wanted the metadata added in the content of the first page, but I honestly don't know if that's legal. I see the line %%BeginDocument: Pscript_Win_PassThrough and from what I saw, the drawing commands begin after that and this code must be added prior to the drawing commands. So, essentially, is their request even a possibility?
Re: Embedding Metadata - Need Some Help.
#677
Author: Aandi_Inston
Date: Mon, 23 Feb 2004 15:18
19 lines
1352 bytes
>Do I understand you correctly that I simply copy the code directly into the .ps file? 

The code has to end up, literally, in the file, one way or another.

>And, is there a unique set of code that is assigned to the "first line"? 

%! 
PostScript file, not DSC

%!PS-Adobe-...
PostScript file, with DSC.

>Our vendor wanted the metadata added in the content of the first page, but I honestly don't know if that's legal. 

Is it document or page level metadata?  In practice anywhere before
the end of the first page is the content of the first page, from this
point of view.

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#678
Author: Tim_Radle
Date: Mon, 23 Feb 2004 15:31
5 lines
1004 bytes
This is document level metadata, but I believe that their concern lies in the fact that if the metadata exists in the header (the definitions prior to the first page) that when the files are concatenated, the metadata definitions will all bunch together and the definitions would become nullified.

Aandi, thanks so much for your help.

Tim
Re: Embedding Metadata - Need Some Help.
#679
Author: Aandi_Inston
Date: Mon, 23 Feb 2004 15:46
9 lines
1058 bytes
If there is existing metadata, you need to manage that. It is
unpredictable what you will end up with (though consistent for a given
case). You may get the first, or the second. Concatenation is
unlikely.

If there may be existing metadata, you may need to strip it - making
this suddenly an awesomely complex task.

Aandi Inston
Re: Embedding Metadata - Need Some Help.
#680
Author: Tim_Radle
Date: Mon, 23 Feb 2004 15:59
1 lines
671 bytes
Thank you so much for your help!!!
Re: Embedding Metadata - Need Some Help.
#689
Author: Dov Isaacs
Date: Mon, 23 Feb 2004 21:26
3 lines
893 bytes
Aandi is not an Adobe employee, but he is highly respected and appreciated by Adobe for his knowledgeable and patient responses in these forums and elsewhere on a variety of PostScript and PDF technical issues.

- Dov
Re: Embedding Metadata - Need Some Help.
#693
Author: Tim_Radle
Date: Wed, 25 Feb 2004 21:49
50 lines
2826 bytes
Thanks Dov.

Now, to whoever wants to address this...

I post the following code into my .PS files, and when distilled, the resultant PDF is 115% the size of the original document. And the size of the PDF is almost exactly half that of the .PS file. Does that make any sense?

Can you tell what I messed up?

Note the position of the code relative to %%EndSetup...

/ncbdict 1 dict def
ncbdict begin	

/currentdistillerparams where
{pop currentdistillerparams /CoreDistVersion get 5000 lt} {true} ifelse

{ncbdict /pdfmark /cleartomark load put
	ncbdict /metafile_pdfmark {flushfile cleartomark} bind put}
{ncbdict /metafile_pdfmark {/PUT pdfmark} bind put} ifelse

%Define the stream object and associate it as metadata
[/_objdef {ncb_metadata_stream} /type /stream /OBJ pdfmark
[{ncb_metadata_stream} 2 dict begin
	/Type /Metadata def /Subtype /XML def currentdict end /PUT pdfmark

%Fill the stream with the XMP Packet...
[{ncb_metadata_stream}
	currentfile 0 (% &&end XMP packet marker&&)
	/SubFileDecode filter metafile_pdfmark

<?xpacket begin='(U+FEFF)' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/'>
<rdf:RDF xmlns:iX='http://ns.adobe.com/iX/1.0/'>
<rdf:Description rdf:about='' xmlns:ncb='//ohclesql1026/ncb/metadata/' ncb:CompTime='COMP_TIME|' ncb:PkgSeq='PKG_SEQUENCE|0000005' ncb:StmtSeq='STMT_SEQUENCE|0000005' ncb:Mail1='MAIL_TO1|THE GOODYEAR TIRE & RUBBER CO' ncb:Mail2='MAIL_TO2|ATTN: BLANCHE ENNALS' ncb:Mail3='MAIL_TO3|GLOBAL BENEFIT FINANCING, DEPT 626' ncb:Mail4='MAIL_TO4|1144 EAST MARKET STREET' ncb:Mail5='MAIL_TO5|AKRON OH 44316-0001' ncb:Mail6='MAIL_TO6|' ncb:ZipCode='ZIP_CODE|' ncb:InsMap='INSERT_MAP|YYYYYYYY' ncb:InsId='INSERT_ID|0010001770 0010001770 0010001770 0010001770 0010001770 0010001770 0010001770 001' ncb:AcctId='ACCOUNT_ID|CN000082' ncb:PaperCde='PAPER_CODE|10001453' ncb:EnvCde='ENV_CODE|10001538' ncb:SpecHand='SPECIAL_HANDLING|N'/>
</rdf:RDF>
</x:xmpmeta>

WHITESPACE.....

<?xpacket end='w'?>

% &&end XMP packet marker&&

%Attach the stream as the main XMP metadata stream
[{Catalog} {ncb_metadata_stream} /Metadata pdfmark

%%EndSetup

Thanks,
Tim
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads