Various PDF conversion problems (2). convert office documents to PDF documents

Source: Internet
Author: User
Tags microsoft website

In principle, once a PDF file is created, it cannot be modified (some operations, such as comments, do not belong to this scope). Because PDF is lightweight and common in format, many enterprises and institutions like to use PDF as the final document issuance format. Converting Office to PDF is a very common operation.

There are many ways to convert office to PDF, but there are three of the most popular ones:

1. Use Microsoft's free office plug-in saveasystandxps. This plug-in can be downloaded directly from the official Microsoft website. It features free of charge and low conversion risks. After the plug-in is installed, a "pdf or XPS" item appears in the "Save as" subitem in the office Start Menu. Click this item to start converting office to PDF. If you want to use a program to call the com library of office to implement the conversion, the operation is not very uniform. There are roughly two methods (the program uses C # as an example ):

1) The saveas method of the Document Object:

        public static void conv(Document document, object oTarget, object oFormat)        {            document.SaveAs(ref oTarget, ref oFormat, ref m_oMissing,                ref m_oMissing, ref m_oMissing, ref m_oMissing, ref m_oMissing,                ref m_oMissing, ref m_oMissing, ref m_oMissing, ref m_oMissing,                ref m_oMissing, ref m_oMissing, ref m_oMissing, ref m_oMissing, ref m_oMissing);        }

For Word, the oformat must be wdsaveformat. wdformatpdf, while for PowerPoint, the format must be ppsaveasfiletype. ppsaveaspdf.


2) Excel seems to only use the exportasfixedformat of the workbook object for conversion to PDF:

        public static void save(Workbook workbook, object oTarget, XlFixedFormatType oFormat)        {            //workbook.Save();            workbook.ExportAsFixedFormat(oFormat, oTarget, XlFixedFormatQuality.xlQualityStandard, m_oTrue, m_oFalse,                m_oMissing, m_oMissing, m_oMissing, m_oMissing);        }

2. Use the Office plug-in of Acrobat. It features high speed and stronger customization capability. Generally, software such as Adobe Acrobat is installed. This plug-in will be automatically installed. Manual operation of this plug-in is very simple, and its operation items are also saved in "Save as" in the office Start Menu. I have not studied how to use a program to perform automatic operations (because the 1st methods can meet my requirements ).


3. Use the aspose control to complete operations related to PDF. Aspose is a group of very powerful controls that I have come into contact with. It is mainly related to office and PDF. With aspose, you can operate the office completely out of the office environment-convert the Office to PDF, and convert PDF to various images easily. For program automation implementation, refer to its official example:

Http://www.aspose.com/demos/default.aspx

Its only drawback may be that the charges are expensive.


Various PDF conversion problems (2). convert office documents to PDF documents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.