How can I save a Word document as a PDF via ACTXSERVER in MATLAB 8.2 (R2013b)?

31 views (last 30 days)
I am trying to save a Word document as a PDF using the ACTXSERVER function in MATLAB together with the Word method PRINTOUT. Although I am specifying that the output file name should have a PDF extension, I do not see it being created.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Oct 2013
The following reference to the Window.PrintOut method in the Word 2013 Dev Center:
shows the syntax of this method to be:
expression.PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)
(Please note that depending on the Word version the number of parameters can vary.)
However, the method PRINTOUT only allows you to print the document to a printer. If you want to save your Word document as a PDF document, you can use the method SAVEAS2. For example:
wrd = actxserver('word.application');
wrdDoc = wrd.Documents;
wrdFile = wrdDoc.Open('TestWord.docx');
where 17 stands for the PDF format.
For more information about formatting values, you may wish to refer to the following link:
and the following link provides further information about SAVEAS2:

More Answers (0)


No tags entered yet.


Community Treasure Hunt

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

Start Hunting!