summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Melichev <igor.melichev@artifex.com>2005-04-05 11:29:16 +0000
committerIgor Melichev <igor.melichev@artifex.com>2005-04-05 11:29:16 +0000
commit8364d28a3a63aa6b2f6299f0dd052f1c02eef361 (patch)
treecc25cc4810c84f5797c27fec2cb09d563157fd9b
parent4def00dfd482e7e45679e5fd44fea0a9863d98ab (diff)
downloadghostpdl-8364d28a3a63aa6b2f6299f0dd052f1c02eef361.tar.gz
ps2write : Implementing a viewer's resource memory control, part 2.
DETAILS : 1. opdfread.ps : Defined the new procedure CleanAllResources and called it after each page, which defines /.ClearResources /All. Currently it cleans all objects and all non-standard fonts. Daemons, if they are stored in the Registry, are not cleaned. (BTW, daemons may contain a reference to an object, but we believe that currently unresolved daemons never appear in Registry when ClearAllResources is being called). 2. ps2write.bat : Updated to involve the resource memory control. See the log message of the previous patch for more information. EXPECTED DIFFERENCES : None. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@5827 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r--gs/lib/opdfread.ps85
-rwxr-xr-xgs/lib/ps2write.bat2
2 files changed, 81 insertions, 6 deletions
diff --git a/gs/lib/opdfread.ps b/gs/lib/opdfread.ps
index b887b33d8..d2da07dee 100644
--- a/gs/lib/opdfread.ps
+++ b/gs/lib/opdfread.ps
@@ -306,6 +306,65 @@ currentdict end readonly def
} ifelse
} bind def
+/StandardFontNames <<
+ /Times-Roman true
+ /Helvetica true
+ /Courier true
+ /Symbol true
+ /Times-Bold true
+ /Helvetica-Bold true
+ /Courier-Bold true
+ /ZapfDingbats true
+ /Times-Italic true
+ /Helvetica-Oblique true
+ /Courier-Oblique true
+ /Times-BoldItalic true
+ /Helvetica-BoldOblique true
+ /Courier-BoldOblique true
+>> def
+
+/CleanAllResources % - CleanAllResources -
+{ //PDFR_DEBUG {
+ (CleanAllResources beg) =
+ } if
+ //PDFReader /ObjectRegistry get
+ dup length 0 exch 1 exch 1 sub { % R i
+ 2 copy get dup xcheck {
+ % Don't clean a daemon.
+ pop pop
+ } {
+ null eq {
+ pop
+ } {
+ //PDFR_DEBUG {
+ (Dropping ) print dup =
+ } if
+ 1 index exch /DroppedObject put
+ } ifelse
+ } ifelse
+ } for
+ pop
+ FontDirectory length dict begin
+ FontDirectory {
+ pop
+ dup //StandardFontNames exch known not {
+ dup null def
+ } if
+ pop
+ } forall
+ currentdict
+ end {
+ pop
+ //PDFR_DEBUG {
+ (Undefining font ) print dup =
+ } if
+ undefinefont
+ } forall
+ //PDFR_DEBUG {
+ (CleanAllResources end) =
+ } if
+} bind def
+
/PrintReference % <array> PrintReference <array>
{
//PDFR_DEBUG {
@@ -357,10 +416,17 @@ currentdict end readonly def
/endobj % <id> <obj> endobj -
{
//PDFR_DEBUG {
- (Storing ) print 1 index =
+ (endobj ) =
} if
- //RunTypeDaemon exec
- //DoNothing 3 1 roll //Register exec
+ dup type /dicttype eq { dup /ImmediateExec known } { false } ifelse {
+ pop pop
+ } {
+ //PDFR_DEBUG {
+ (Storing ) print 1 index =
+ } if
+ //RunTypeDaemon exec
+ //DoNothing 3 1 roll //Register exec
+ } ifelse
} bind def
/StoreBlock % <buf> StoreBlock -
@@ -578,6 +644,11 @@ currentdict end readonly def
} {
//StoreStream exec
} ifelse
+ dup /.CleanResources //knownget exec {
+ /All eq {
+ //CleanAllResources exec
+ } if
+ } if
} bind def
/endstream % <id> <obj> endstream <id> <obj>
@@ -2092,7 +2163,9 @@ end
/ReadSamples % <dimensions> ReadSamples -
{ % The reader in on the dictionary stack.
- (ReadSamples beg ) print count =
+ //PDFR_DEBUG {
+ (ReadSamples beg ) print count =
+ } if
dup 1 eq {
pop
0 1 Size 0 get 1 sub {
@@ -2118,7 +2191,9 @@ end
//ReadSamplesRec exec
} forall
} ifelse
- (ReadSamples end ) print count =
+ //PDFR_DEBUG {
+ (ReadSamples end ) print count =
+ } if
} bind def
//ReadSamplesRec 0 //ReadSamples put
diff --git a/gs/lib/ps2write.bat b/gs/lib/ps2write.bat
index 6bb1bb16d..4e51f82c4 100755
--- a/gs/lib/ps2write.bat
+++ b/gs/lib/ps2write.bat
@@ -1,5 +1,5 @@
@rem $Id$
@rem Converting Postscript 3 or PDF to PostScript 2.
-%GSC% -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=temp.pdf %more_param% -c mark /ForOPDFRead true /CompressPages false /CompressFonts false /ASCII85EncodePages true .dicttomark setpagedevice -f %1
+%GSC% -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=temp.pdf %more_param% -c mark /ForOPDFRead true /MaxViewerMemorySize 8000000 /CompressPages false /CompressFonts false /ASCII85EncodePages true .dicttomark setpagedevice -f %1
copy /b %GS_LIBPATH%opdfread.ps+%GS_LIBPATH%gs_agl.ps+%GS_LIBPATH%gs_mro_e.ps+%GS_LIBPATH%gs_mgl_e.ps+temp.pdf+%GS_LIBPATH%EndOfTask.ps %2