Matlab Engine does not print in PDF

조회 수: 2 (최근 30일)
Debjit Pal
Debjit Pal 2013년 4월 2일
engEvalString(MyMatlabEngine, "for i=1:1:2 \
Handle(i) = subplot(2,1,i); \
bar(RangePointVal, RangeValPoints(i,:));\
xlabel('Range of Evaluation Bias');\
ylabel('Fraction of Runs in each Range'); \
end");
engEvalString(MyMatlabEngine, "title(Handle(1), 'Plots for Successful Runs'); title(Handle(2),'Plots for Failure Runs');");
engEvalString(MyMatlabEngine, "Han = gcf");
engEvalString(MyMatlabEngine,"print(Han, '-dpdf', 'C:\Users\Debjit\Documents\MyFig.pdf')");
Hi All,
I have written the above code to get a pdf copy of the figure automatically. But I am not getting any figure printed although they are coming perfectly in the Figure window. Any idea or comment is welcome.
Thanks in advance for your kind support.
Thanks and Regards,
Debjit.

답변 (1개)

arron
arron 2013년 8월 13일
The virtual PDF printer that you're using to make that new PDF is less efficient than whatever was used to create the original PDF.
If you open up the PDF in Foxit, and then print it to a PDF printer, then obviuosly the PDF is being generated anew.
You might have thought that there is only one way to generate that PDF, and different programs generating the PDF will do so using the same way. But this isn't true. There's a nearly infinite number of ways to generate PDFs that output the same result. Different programs will do it using different methods, and these can be changed by setting options in the programs.
8MB is not that much bigger than 2MB. Yes, it's 400%. But it's also just an additional 6MB. These days, that's nothing. Just forget it and don't waste your time.
But if you really want to spend time figuring this out, you'd want programs that edit the PDF files directly, chopping up pages, without reencoding. There utilities like pdftk and jpdftweak, that are focused on extracting pages, and that MIGHT do this. (Though I'm not 100% sure that they do not simply re-encode). But choosing a fine PDF SDK is a good choice for you. You can refer to it for help amd make your project perfect. I hope you sucess. Good luck.
Best regards, Arron

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by