Re: dvipdfm(x)におけるしおりの展開

名前: Jin-Hwan Cho
日時: 2003-08-23 17:18:32
IPアドレス: 210.98.29.*

>>20937 In fact, the current version of DVIPDFM(x) has no ability to control the open level of bookmarks. Akira's idea using a new option '-E' is a temporary solution. It means that the option just makes the bookmark items being open or being closed. To implement the same feature as pdfTeX, two parts should be modified. The first one is the DVIPDFM module of hyperref.sty (hdvipdfm.def). In the definition of \ReadBookmarks, change the line 771 as follows: outline ##2##1 << Then, the "outline" special accepts the negative level too. Next, we should modify the source code of DVIPDFMx. The following is the modification to implement this feature. If you have time, please check the codes. Best, ChoF. --- pdfdoc.c 2003-08-23 16:58:32.000000000 +0900 +++ pdfdoc.c.new 2003-08-23 16:50:40.000000000 +0900 @@ -55,7 +55,7 @@ int outline_depth=0; static struct { - int kid_count; + int kid_count, open; pdf_obj *entry; } outline[MAX_OUTLINE_DEPTH]; @@ -215,6 +215,7 @@ /* Create empty outline tree */ outline[outline_depth].entry = pdf_new_dict(); outline[outline_depth].kid_count = 0; + outline[outline_depth].open = 1; return; } @@ -499,9 +500,9 @@ pdf_new_name ("Last"), pdf_ref_obj (outline[i+1].entry)); if (i > 0) - tmp1 = pdf_new_number (-outline[i].kid_count); + tmp1 = pdf_new_number (-outline[i].kid_count * outline[i].open); else - tmp1 = pdf_new_number (outline[i].kid_count); + tmp1 = pdf_new_number (outline[i].kid_count * outline[i].open); pdf_add_dict (outline[i].entry, pdf_link_obj (count_name), @@ -512,6 +513,7 @@ pdf_release_obj (outline[i].entry); outline[i].entry = NULL; outline[i].kid_count = 0; + outline[i].open = 1; } outline_depth = new_depth; } @@ -532,7 +534,7 @@ } -void pdf_doc_add_outline (pdf_obj *dict) +void pdf_doc_add_outline (pdf_obj *dict, int open) { pdf_obj *new_entry; if (outline_depth < 1) @@ -571,6 +573,7 @@ outline[outline_depth].entry = new_entry; /* Just born, so don't have any kids */ outline[outline_depth].kid_count = 0; + outline[outline_depth].open = open; } struct dests --- pdfdoc.h 2003-08-23 16:58:32.000000000 +0900 +++ pdfdoc.h.new 2003-08-23 16:51:20.000000000 +0900 @@ -60,7 +60,7 @@ extern void pdf_doc_add_to_page (char *buffer, unsigned length); extern void pdf_doc_change_outline_depth (int new_depth); -extern void pdf_doc_add_outline (pdf_obj *dict); +extern void pdf_doc_add_outline (pdf_obj *dict, int open); extern void pdf_doc_init (char *filename); extern void pdf_doc_close (void); --- pdfspecial.c 2003-08-23 16:58:32.000000000 +0900 +++ pdfspecial.c.new 2003-08-23 16:56:18.000000000 +0900 @@ -849,14 +849,13 @@ save = *start; if ((level = parse_pdf_object(start, end)) != NULL && level -> type == PDF_NUMBER) { + int abs_level = abs((int)pdf_number_value(level)); /* Make sure we know where the starting level is */ - if ( (int) pdf_number_value (level) < lowest_level) - lowest_level = (int) pdf_number_value (level); + if (abs_level < lowest_level) lowest_level = abs_level; if ((result = parse_pdf_out_dict(start, end)) != NULL) { - pdf_doc_change_outline_depth - ((int)pdf_number_value(level)-lowest_level+1); - pdf_doc_add_outline (result); + pdf_doc_change_outline_depth(abs_level-lowest_level+1); + pdf_doc_add_outline(result, ((int)pdf_number_value(level) < 0 ? 1 : -1)); } else { fprintf (stderr, "\nIgnoring invalid dictionary\n"); error = 1;

この書き込みへの返事:

お名前
題名 
メッセージ(タグは <a href="...">...</a> だけ使えます)