Patch PreventInfoDictDupes (was: [pdftex] Two /Creator or /Producer
entries)
Heiko Oberdiek
oberdiek at uni-freiburg.de
Sun Feb 9 03:33:28 CET 2003
Hello,
in the beginning of last October the following thread starts
and has ended without result:
On Tue, Oct 01, 2002 at 10:16:31AM +0200, Heiko Oberdiek wrote:
> there is a thread in comp.text.tex,
> subject: problem with PDFTeX and hyperref
>
> Dan Luecking <luecking at uark.edu> wrote:
>
> > >Why are there 2 /Creator objects in the resulting PDF Info dictionary?
> > >It is interfering with another application I'm using to encrypt the file.
> > >The PDF spec indicates this shouldn't happen.
> > >
> > >Has anyone else experienced this?
> >
> > Must be new with pdftex 1.10. pdftex 1.00b doesn't set the
> > /Creator field. I guess hyperref will have to be updated so as
> > not to add its own /Creator field.
>
> It should be possible to set the /Creator field, so I consider
> this as bug of pdfTeX and not as problem of hyperref.
> With version 1.00b I get two /Producer entries.
Now I have written a patch. It looks for the info token
list for the presence of keys. If they are set, then
the default settings of pdfTeX are suppressed.
The implementation is done by converting the
token list to a string and the keys "/Creator",
"/Producer", and "/CreationDate" are detected
by simple string comparison.
%%% cut %%% pdftex.ch.diff %%% cut %%%
*** pdftex.ch.org Thu Jan 16 17:44:29 2003
--- pdftex.ch Sun Feb 9 02:59:46 2003
***************
*** 4494,4509 ****
pdf_str_entry_ln("PTEX.Fullbanner", pdftex_banner);
pdf_end_dict
! @ @<Output the info object@>=
! pdf_new_dict(obj_type_others, 0);
! @<Print the Producer key@>;
! if pdf_info_toks <> null then begin
! pdf_print_toks_ln(pdf_info_toks);
! delete_toks(pdf_info_toks);
end;
! pdf_str_entry_ln("Creator", "TeX");
! @<Print the CreationDate key@>;
! pdf_end_dict
@ @<Print the Producer key@>=
pdf_print("/Producer (pdfTeX-");
--- 4494,4561 ----
pdf_str_entry_ln("PTEX.Fullbanner", pdftex_banner);
pdf_end_dict
! @ If the same keys in a dictionary are given several times,
! then it is not defined which value is choosen by an application.
! Therefore the keys |/Producer| and |/Creator| are only set,
! if the token list |pdf_info_toks|, converted to a string does
! not contain these key strings.
!
! @p function substr_of_str(s, t: str_number):boolean;
! label continue,exit;
! var j, k, kk: pool_pointer; {running indices}
! begin
! k:=str_start[t];
! while (k < str_start[t+1] - length(s)) do begin
! j:=str_start[s];
! kk:=k;
! while (j < str_start[s+1]) do begin
! if str_pool[j] <> str_pool[kk] then
! goto continue;
! incr(j);
! incr(kk);
! end;
! substr_of_str:=true;
! return;
! continue: incr(k);
! end;
! substr_of_str:=false;
! end;
!
! procedure pdf_print_info; {print info object}
! var s: str_number;
! creator_given, producer_given, creationdate_given: boolean;
! begin
! pdf_new_dict(obj_type_others, 0);
! creator_given:=false;
! producer_given:=false;
! creationdate_given:=false;
! if pdf_info_toks <> null then begin
! s:=tokens_to_string(pdf_info_toks);
! creator_given:=substr_of_str("/Creator", s);
! producer_given:=substr_of_str("/Producer", s);
! creationdate_given:=substr_of_str("/CreationDate", s);
! end;
! if not producer_given then begin
! @<Print the Producer key@>;
! end;
! if pdf_info_toks <> null then begin
! if length(s) > 0 then begin
! pdf_print(s);
! pdf_print_nl;
! end;
! flush_str(s);
! delete_toks(pdf_info_toks);
! end;
! if not creator_given then
! pdf_str_entry_ln("Creator", "TeX");
! if not creationdate_given then begin
! @<Print the CreationDate key@>;
! end;
! pdf_end_dict
end;
!
! @ @<Output the info object@>=
! pdf_print_info;
@ @<Print the Producer key@>=
pdf_print("/Producer (pdfTeX-");
%%% cut %%% pdftex.ch.diff %%% cut %%%
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
--
More information about the pdftex
mailing list