The ConvertWordDocument2 converts a Word document to PDF. Internet and internal document links can be converted to PDF hyperlinks. Word Headings and WOrd bookmarks can be converted to PDF bookmarks.
HRESULT ConvertWordDocument2(
[in, string] BSTR p_wsDocName,
[in] BOOL p_bConvertHeadings,
[in] BOOL p_bConvertBookmarks,
[in] BOOL p_bConvertCrossReferenceLinks,
[in] BOOL p_bConvertCrossDocumentLinks,
[in] BOOL p_bConvertInternetLinks,
[in] BOOL p_bConvertLinksInHeaderFooter,
[in] BOOL p_bUseRelativePaths,
[in] BOOL p_bChangeFileExtensionToPDF,
[in] BOOL p_bOpenFileInNewTab,
[in] BOOL p_bConvertFootEndNotesLinks,
[in] BOOL p_bPrintComments,
[in] UINT p_nStyleCount,
[in, string] BSTR p_pwsStyleView,
[in] BOOL p_bWaitPDF
);
Parameters:
p_wsDocName
[in] Word document name with full path
p_bConvertHeadings
[in] flag, if set to 1 Word Headings will be added as PDF bookmarks
p_bConvertBookmarks
[in] flag, if set to 1 Word bookmarks will be added as PDF bookmarks
p_bConvertCrossReferenceLinks
[in] flag, if set to 1 cross reference links (links inside the document) will be converted to PDF hyperlinks
p_bConvertCrossDocumentLinks
[in] flag, if set to 1 cross document links (links to other documents) will be converted to PDF hyperlinks
p_bConvertInternetLinks
[in] flag, if set to 1 Internet links will be converted to PDF hyperlinks
p_bConvertLinksInHeaderFooter
[in] flag, if set to 1 links from header and footer will be converted to PDF hyperlinks
p_bUseRelativePaths
[in] flag, for cross document links, use relative paths for files
p_bChangeFileExtensionToPDF
[in] flag, for cross document links, change file extension to.pdf
p_bOpenFileInNewTab
[in] flag, for pdf documents links, open them in a new tab in Adobe Reader
p_bConvertFootEndNotesLinks
[in] flag, if set to 1 footnote and endnote links will be converted to PDF hyperlinks
p_bPrintComments
[in] flag, if set to 1 Word comments will be printed with the documents
p_nStyleCount
[in] count of styles in p_pwsStyleView parameter
p_pwsStyleView
[in] string with a list of Word headings to be converted as bookmarks; Headings are separated by ";" and for each heading there are specified heading name, heading level and heading type (for now use 0 as Standard type). Sample : "Heading 1|1|0;Heading 2|2|0"
p_bWaitPDF
[in] flag, if set function returns after pdf is saved and all actions executed
Return values:
S_OK
on success or COM error codeNV_NOT_INITIALIZED
- Initialize was not calledNV_OPENFILE_ERROR
- failed to open the documentNV_FILEPROCESS_ERROR
- failed to read document information