print pdf / post Script adding a bookmark

1 回表示 (過去 30 日間)
Ignacio
Ignacio 2014 年 10 月 24 日
編集済み: Ignacio 2015 年 1 月 15 日
Hi, I would like to create a postscript file and add to it a bookmark telling what each page is. Any idea how to implement it without using external files? Right now I can create a multipage pdf from a postscript file but I would like to add to my pdf a bookmark too.
Thanks!

回答 (1 件)

Ignacio
Ignacio 2015 年 1 月 15 日
編集済み: Ignacio 2015 年 1 月 15 日
I answer my self. First I create a multipage .eps file. Once I have this multipage .eps file, I add the bookmark. Code is as follows:
---------------------
%Create a figure
print( 'file.eps', '-dpsc');
%Create another figure
print( 'file.eps', '-dpsc','-append');
%Do the same again and again...
...
%Create bookMarks
sBookMarks = strrep(sBookMarks ,'%%BeginProlog', sprintf('[/Title (%s) /Page 1 /OUT pdfmark [/Title (%s) /Page 2 /OUT pdfmark [/Title (%s) /Page 3 /OUT pdfmark [/Title (%s) /Page 4 /OUT pdfmark [/Title (%s) /Page 5 /OUT pdfmark [/Title (%s) /Page 6 /OUT pdfmark [/Title (%s) /Page 7 /OUT pdfmark [/Title (%s) /Page 8 /OUT pdfmark [/Title (%s) /Page 9 /OUT pdfmark [/Title (%s) /Page 10 /OUT pdfmark [/Title (%s) /Page 11 /OUT pdfmark [/Title (%s) /Page 12 /OUT pdfmark',... sTitle1 , sTitle2 , sTitle3 , sTitle4 , sTitle5 , sTitle6 , sTitle7 , sTitle8 , sTitle9 , sTitle10, sTitle11, sTitle12));
%Open file.eps
fid = fopen('file.eps', 'w');
%Incorporate the bookmarks to the file
fwrite(fid , sBookMarks , 'char*1');
%Close file
fclose( fid );
----------------------
I create a different bookmark for each page. Then, you can transform the .eps file with the included bookmarks in a pdf using for example the pdf creator.
If you want to read more about this topic, I found the solution reading this website: http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/
Best regards,
Ignacio

カテゴリ

Help Center および File ExchangeScripts についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by