print pdf / post Script adding a bookmark

조회 수: 5 (최근 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 CenterFile Exchange에서 Scripts에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by