Filter löschen
Filter löschen

Matlab Engine does not print in PDF

3 Ansichten (letzte 30 Tage)
Debjit Pal
Debjit Pal am 2 Apr. 2013
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'); \
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,

Antworten (1)

arron am 13 Aug. 2013
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


Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by