MATLAB Answers

How do i sent a document to printer.

29 ビュー (過去 30 日間)
Dragos Radu
Dragos Radu 2014 年 9 月 2 日
コメント済み: Sunilkumar K 2020 年 2 月 13 日
Hi! i need to create an application that controls my printer. i have a Samsung SCX 3405 F (USB connection). i have searched a lot but couldn't find a command that will send documents (such as .doc, .docx, .pdf) to the printer. please help me. thank you!

  1 件のコメント

Dragos Radu
Dragos Radu 2014 年 9 月 2 日
please help me!

サインインしてコメントする。

採用された回答

Joseph Cheng
Joseph Cheng 2014 年 9 月 2 日
you could create batch files for specific file formats that you can use the matlab system() command for window's commands to run to print specific files. The best resource i found on doing this can be found here. There will be some adjustments so you can specify a specific file name instead of the batch folder prints, but the commands to print the files are in there.

  0 件のコメント

サインインしてコメントする。

その他の回答 (6 件)

Andrew Bliss
Andrew Bliss 2016 年 5 月 10 日
Simplest solution in Matlab on Windows is something like:
system('"C:\Program Files\Microsoft Office\Office15\Winword.exe" /mFilePrintDefault C:\ExampleFile.docx &')

  1 件のコメント

Sunilkumar K
Sunilkumar K 2020 年 2 月 13 日
Hi Andrew,
This command is not working for .pdf. It saying, there was an error opening this document.This file Can't be found.
This is the command i have given:
system('"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /mFilePrintDefault C:\shalini_MATLAB\hello.pdf &')
Can you help me out with this?

サインインしてコメントする。


Pratik Bajaria
Pratik Bajaria 2014 年 9 月 2 日
Hello,
I suggest you to check "print" function in matlab. Go through following link http://www.mathworks.in/help/matlab/creating_plots/how-to-print-or-export.html
Hope it helps
Regards, Pratik

  1 件のコメント

Dragos Radu
Dragos Radu 2014 年 9 月 2 日
thank you for your fast response. i looked in the help section. all i could find was how to export figures and text. i want to create a program that use my printer driver to print files specified by me only if certain conditions are achieved.

サインインしてコメントする。


Adam
Adam 2014 年 9 月 2 日
Have you looked at the 'Printing and Exporting' section of the Matlab help? It includes examples of how to do certain printer-related activities.

  1 件のコメント

Dragos Radu
Dragos Radu 2014 年 9 月 2 日
thank you for your fast response. i looked in the help section. all i could find was how to export figures and text. i want to create a program that use my printer driver to print files specified by me only if certain conditions are achieved.

サインインしてコメントする。


Iain
Iain 2014 年 9 月 2 日
編集済み: Iain 2014 年 9 月 2 日
I can't see any immediately obvious way of achieving what you want. Sadly.
I can however see that there may be three solutions that make sense.
1. Learn how to use ActiveX to tell word to open the file(s) you want to print, and use ActiveX to tell word to print them. - xlsread & xlswrite show you vaguely how to do it on excel. You will want to record macros/get specific VB help to find out how to print documents.
2. Copy the files you want to print to a specified folder, then you can batch print from windows.
3. Find from somewhere an executable program that can be called by DOS that does what you want, then issue system commands to instruct that executable program correctly.

  0 件のコメント

サインインしてコメントする。


Gitesh Nandre
Gitesh Nandre 2014 年 9 月 2 日
I understand that you want to print certain document files in a programmatic way using MATLAB. There is no direct solution for this. However, you can use following workaround suggested by MathWorks support team.

  0 件のコメント

サインインしてコメントする。


Dragos Radu
Dragos Radu 2014 年 9 月 2 日
thank you everybody! it seems that i need to learn some VB.

  0 件のコメント

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by