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)