How to convert a Word document to a PDF file

Source: Internet
Author: User
Many people ask me how to convert a Word document into a PDF file and use a program.

Package com. zms. office2pdf;

Import JP. ne. so_net.ga2.no_ji.jcom.idispatch;
Import JP. ne. so_net.ga2.no_ji.jcom.releasemanager;

Public class office2pdf {

Public void createpdf (string officepath, string pdfpath) throws exception {
Releasemanager Rm = NULL;
Idispatch APP = NULL;
Try {
Rm = new releasemanager ();
APP = new idispatch (RM, "mongomakerapi. mongomakerapp ");
App. Method ("createpdf", new object [] {officepath, pdfpath });
} Catch (exception e ){
Throw E;
} Finally {
Try {
APP = NULL;
Rm. Release ();
Rm = NULL;
} Catch (exception e ){
Throw E;
}
}
}

Public static void main (string [] ARGs) throws exception {
Office2pdf one = new office2pdf ();
One. createpdf ("C: // zms // temp // a.ppt", "C: // zms // temp ///c.pdf ");
}
}

Is it easy? In fact, this function can convert office documents (Word, Excel, PowerPoint) into PDF files
This Code uses jcom (http://sourceforge.net/projects/jcom), a small Japanese project
Your machine needs to install MS Office and Acrobat (not Reader)

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.