diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2010-12-09 14:20:46 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2010-12-09 14:20:46 +0000 |
commit | 79f7ea4954d7ae0917f80941a52dcfa9071258d0 (patch) | |
tree | 09175f2bb96ca1b71444343363259c7bdd2eb692 /gs/base/gdevpdfo.c | |
parent | fc395f3b6e5670025db32ea9e1841d34c3adb064 (diff) |
pdfwrite enhancement : More work towards DSC compliance
We now pass around the 'type' of an object much more when writing. This is so that
we can emit "%%BeginResource/%%EndResource" comment pairs around the resources we write.
It is also required so that we *don't* write these comments around pages.
The code now emits %%BeginProlog, then writes the opdfread.ps procedure. It then writes
all the various resources used in the document, each with a reasonable DSC comment. Then
it writes %%EndProlog. After this come the page descriptions, each is written with a
%%Page: comment and a %%PageTrailer. Finally we write the %%Trailer, %%Pages
comment (NB we write %%Pages: (atend) in the header comments as we don't know how many
pages there will be until the end) and %%EOF.
The resources are mostly defined as being of type 'file', as most of them are not normal
PostScript resources. The DSC specification says under the %%BeginResource definition
(file note on p72) "The enclosed segment is a fragment of PostScript language code or
some other item that does not fall within the other resource categories" and so this
seems the best type to use for our purposes.
The output is now minimally DSC compliant, though there are a few other comments I'd
lie to add if possible. Given the way the file is created we are always going to have a
large prolog, and that will need to be copied to all the pages if they are split
individually, in order to make sure that all the required resources are present.
Technically we could follow the resource chain and write %%IncludeResource comments,
at the page level at least, but this is probably more effort than it is realistically
worth.
Still need to add some more comments, and run some extensive testing.
No differences expected currently. Minimal testing with GSView suggests that the output
so far is DSC-compliant as-is.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11941 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gdevpdfo.c')
-rw-r--r-- | gs/base/gdevpdfo.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gs/base/gdevpdfo.c b/gs/base/gdevpdfo.c index ca0b85f89..eaa0e9a56 100644 --- a/gs/base/gdevpdfo.c +++ b/gs/base/gdevpdfo.c @@ -219,15 +219,15 @@ cos_write(const cos_object_t *pco, gx_device_pdf *pdev, gs_id object_id) /* Write a cos object as a PDF object. */ int -cos_write_object(cos_object_t *pco, gx_device_pdf *pdev) +cos_write_object(cos_object_t *pco, gx_device_pdf *pdev, pdf_resource_type_t type) { int code; if (pco->id == 0 || pco->written) return_error(gs_error_Fatal); - pdf_open_separate(pdev, pco->id); + pdf_open_separate(pdev, pco->id, type); code = cos_write(pco, pdev, pco->id); - pdf_end_separate(pdev); + pdf_end_separate(pdev, type); pco->written = true; return code; } @@ -871,7 +871,7 @@ cos_dict_objects_write(const cos_dict_t *pcd, gx_device_pdf *pdev) if (COS_VALUE_IS_OBJECT(&pcde->value) && pcde->value.contents.object->id && !pcde->value.contents.object->written /* ForOPDFRead only. */) - cos_write_object(pcde->value.contents.object, pdev); + cos_write_object(pcde->value.contents.object, pdev, resourceOther); return 0; } int |