Placing plots into multiple page pdf document

조회 수: 56 (최근 30일)
Aleg
Aleg 2012년 11월 6일
편집: Nikhil Sapre 2021년 11월 10일
G'day,
I'm a bit stuck at a simple question: how can I create a single pdf file with multiple plots and pages? Multiple page is what I need. I could not find a solution to this simple task in the Internet.
Thanks
  댓글 수: 3
ahmed
ahmed 2013년 9월 27일
Same here ?
david Miller
david Miller 2019년 5월 14일
Also have this question!

댓글을 달려면 로그인하십시오.

채택된 답변

Jonathan Epperl
Jonathan Epperl 2012년 11월 8일
I don't think that Matlab can create multi-page pdfs for you, you'll have to do that yourself. pdfsam http://www.pdfsam.org is free and does just that.
If you want to do it only occasionally, then you can use the Matlab figure window to export to pdf, and the pdfsam GUI to merge them into a single pdf.
If you want to do it in an automated way from the commandline, then you can use Matlab's print command or one of the many much better functions from the FEX (e.g. http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig) and then pdfsam's console interface to merge them. You can call the console interface from the Matlab command line either by
!command
or
system('command')
As a third option, you could generate and compile a latex file from the Matlab command line, that's probably what I would do, but it depends on what you're comfortable with.
Btw, this is all assuming you're on Windows, if you're on a Mac, then preview.app can do the merging, you don't need pdfsam. For Linux, I'm sure, there is something similar.
  댓글 수: 2
Jonathan Epperl
Jonathan Epperl 2012년 11월 8일
Look what I just found in the documentation of export_fig:
-append - option indicating that if the file (pdfs only) already
exists, the figure is to be appended as a new page, instead
of being overwritten (default).
So now this offers you the 4th and probably easiest option!
Aleg
Aleg 2012년 11월 13일
Hi Jonathan,
Thanks a lot for the answer. It works. :)

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Oliver Woodford
Oliver Woodford 2012년 11월 23일
The append_pdfs function can concatenate separate pdf files into a single document in MATLAB.

jwiix
jwiix 2016년 3월 30일
I had the same question. the best alternative I came up with programmatically is to use postscript, this allows you to use the append option within the print command:
print(fig_handle, '-dpsc', '-append', 'D:\output_dir\output_file.ps')
if you really require a pdf then you can utilise ps2pdf.com or equivalent to convert

Nikhil Sapre
Nikhil Sapre 2021년 11월 10일
편집: Nikhil Sapre 2021년 11월 10일
Release 2021b now supports exporting to a multipage pdf using the exportgraphics function

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by