print pdf / post Script adding a bookmark

11 vues (au cours des 30 derniers jours)
Ignacio
Ignacio le 24 Oct 2014
Modifié(e) : Ignacio le 15 Jan 2015
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!

Réponses (1)

Ignacio
Ignacio le 15 Jan 2015
Modifié(e) : Ignacio le 15 Jan 2015
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

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by