[gs-code-review] Patch for 689413, running default file from PDF collection

Igor V. Melichev igor.melichev at artifex.com
Wed Oct 24 11:20:03 PDT 2007


For temp file deletion seek for 'tempfiles'
in gs_init.ps and in imain.c .

I'm not sure what do you mean with (3).
Please explain better.

Igor.


----- Original Message ----- 
From: "Alex Cherepanov" <alexcher at quadnet.net>
To: <gs-code-review at ghostscript.com>
Sent: Wednesday, October 24, 2007 6:49 AM
Subject: [gs-code-review] Patch for 689413,running default file from PDF 
collection


> Display the default file in PDF file by extracting it from the embedded
> file stream to a temporary file and re-starting the PDF interpreter.
>
> The patch is quite straightforward but there are a few issues related
> to the PDF file collection I'd like to discuss.
>
> 1. The patch doesn't delete the temp file. An simple appoach would
>    be saving the file and the file name and delete the file
>    in runpdfend procedure.
>
>    Alternatively, we can create a file that deletes itself from
>    disk when it is closed.
>
> 2. Currently, there's no way to select non-default files from the
>    collection. The content of the collection is not listed either.
>    Suggestions about the user's interface are welcome.
>
> 3. The current code location is inconvenient for rendering of
>    multiple files from the collection. Do we need this feature?
>
> Regards,
> Alex Cherepanov
>
>


--------------------------------------------------------------------------------


> Index: gs/lib/pdf_main.ps
> ===================================================================
> --- gs/lib/pdf_main.ps (revision 8312)
> +++ gs/lib/pdf_main.ps (working copy)
> @@ -467,6 +467,40 @@
>     }
>    if
>   pdfopenfile begin
> +  Trailer /Root oget /Collection knownoget {
> +    /D knownoget { % We have default document in the collection
> +      Trailer /Root oget /Names knownoget {
> +        /EmbeddedFiles knownoget {
> +          exch nameoget dup //null ne {
> +            /EF knownoget {
> +              /F knownoget {
> +                //true resolvestream    % strm
> +                //null (w+) .tempfile   % strm (name) file
> +                3 -1 roll               % (name) file strm
> +         32768 string            % (name) file strm (buf)
> +         { 3 copy readstring     % (name) file strm (buf) file (data) 
> bool
> +                  3 1 roll              % (name) file strm (buf) bool 
> file (data)
> +                  writestring           % (name) file strm (buf) bool
> +       not { exit } if
> +         } loop
> +                pop closefile           % (name) file
> +                exch pop                % file   %  can't delete temp 
> file here
> +         dup 0 setfileposition
> +                end  % old state
> +                pdfopenfile begin
> +              } if
> +            } if
> +          } {
> +            pop
> +          } ifelse
> +        } {
> +          pop
> +        } ifelse
> +      } {
> +        pop
> +      } ifelse
> +    } if
> +  } if
>   pdfopencache
>   writeoutputintents
>   .writepdfmarks {
>


--------------------------------------------------------------------------------


> _______________________________________________
> gs-code-review mailing list
> gs-code-review at ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
> 



More information about the gs-code-review mailing list