word automation save as pdf

3.6k Views Asked by At

When saving a document as pdf in MS Word 2010 we get other options like "optimize for". These options can not be set as parameters of Document.Saveas function in c#. Please tell how can i set these options before saving a pdf.

Document doc = word.Documents.Open(ref filename, ref oFalse, ref oTrue, ref oFalse, "?#nonsense@$", "?#nonsense@$", ref oTrue, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oFalse, ref oFalse, WdDocumentDirection.wdLeftToRight, ref oTrue);
doc.Activate();
object outputFileName = wordFile.FullName.Replace(".docx", ".pdf");
object fileFormat = WdSaveFormat.wdFormatPDF;
// Save document into PDF Format
doc.SaveAs(ref outputFileName, ref fileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oFalse);
1

There are 1 best solutions below

0
On

OptimizeFor parameter in Document.ExportAsFixedFormat will do your need