2011-07-04 5 views
0

으로 변환합니다. Office 문서를 pdf.i로 변환하고 싶습니다. Microsoft Office 서비스 ddl을 사용하고 싶지 않습니다. 이 내가 com.does의 사람이 내가 itextsharp.it는 변환하지 않습니다 시도? 나에게 도움이 될 아는하지 않는 어셈블리를 사용하려면 내가 사용되는 코드,Office 문서를 C#

using System; 
using System.IO; 
using Microsoft.Office.Interop.Word; 
using System; 
using System.Collections.Generic; 
using System.IO; 
using System.Linq; 
using System.Text; 
using System.IO.Compression; 
using Document = Microsoft.Office.Interop.Word.Document; 
    namespace pdfconversion 
{ 
    public class PdfMerge 
    { 
     static void Main() 
     { 
      var wordApplication = new Microsoft.Office.Interop.Word.Application(); 
      Document wordDocument = null; 
      object paramSourceDocPath = @"C:\testfile.doc"; 
      object paramMissing = Type.Missing; 
      string paramExportFilePath = @"C:\Temp\Test1234.xps"; 
      WdExportFormat paramExportFormat = WdExportFormat.wdExportFormatXPS; 
      bool paramOpenAfterExport = false; 
      WdExportOptimizeFor paramExportOptimizeFor = 
       WdExportOptimizeFor.wdExportOptimizeForPrint; 
      WdExportRange paramExportRange = WdExportRange.wdExportAllDocument; 
      int paramStartPage = 0; 
      int paramEndPage = 0; 
      WdExportItem paramExportItem = WdExportItem.wdExportDocumentContent; 
      bool paramIncludeDocProps = true; 
      bool paramKeepIRM = true; 
      WdExportCreateBookmarks paramCreateBookmarks = 
       WdExportCreateBookmarks.wdExportCreateWordBookmarks; 
      bool paramDocStructureTags = true; 
      bool paramBitmapMissingFonts = true; 
      bool paramUseISO19005_1 = false; 
       try 
      { 
       // Open the source document. 
       wordDocument = wordApplication.Documents.Open(
        ref paramSourceDocPath, ref paramMissing, ref paramMissing, 
        ref paramMissing, ref paramMissing, ref paramMissing, 
        ref paramMissing, ref paramMissing, ref paramMissing, 
        ref paramMissing, ref paramMissing, ref paramMissing, 
        ref paramMissing, ref paramMissing, ref paramMissing, 
        ref paramMissing); 
        // Export it in the specified format. 
       if (wordDocument != null) 
        wordDocument.ExportAsFixedFormat(paramExportFilePath, 
         paramExportFormat, paramOpenAfterExport, 
         paramExportOptimizeFor, paramExportRange, paramStartPage, 
         paramEndPage, paramExportItem, paramIncludeDocProps, 
         paramKeepIRM, paramCreateBookmarks, paramDocStructureTags, 
         paramBitmapMissingFonts, paramUseISO19005_1, 
         ref paramMissing); 
      } 
      catch (Exception ex) 
      { 
       // Respond to the error 
      } 
      finally 
      { 
       // Close and release the Document object. 
       if (wordDocument != null) 
       { 
        wordDocument.Close(ref paramMissing, ref paramMissing, 
         ref paramMissing); 
        wordDocument = null; 
       } 
        // Quit Word and release the ApplicationClass object. 
       if (wordApplication != null) 
       { 
        wordApplication.Quit(ref paramMissing, ref paramMissing, 
         ref paramMissing); 
        wordApplication = null; 
       } 
        GC.Collect(); 
       GC.WaitForPendingFinalizers(); 
       GC.Collect(); 
       GC.WaitForPendingFinalizers(); 

이다. cutepdf는 pdf로 직접 변환 할 수 없습니다. 이걸로 나를 도와주세요. 나는 고스트 스크립트를 시도했다. 하지만 postscripts를 pdf로 변환하면 Office 문서를 .ps로 변환하는 방법을 찾을 수 없습니다. 내 요구 사항을 충족하는 데 사용할 수있는 다른 무료 라이브러리가 있습니까?

여기 고맙습니다

답변

0

나는 최근 PDF로 문서를 변환하는 무료 소프트웨어를 많이 봤는데 내가 그들 중 누구도 내 요구 사항을 충족되지 않았 음을 인정합니다 좀 도와주십시오. 일부 변환기는 나쁘지 않았지만 라이센스는 제한적이었습니다. 나는 당신이 좋은 비 자유로운 변환기를 찾아야 할 것이라고 생각한다.

당신은보고를 PDF 변환기의 목록을 수행 할 수 있습니다 Converters

+0

의견이 있으십니까? 네가 시도한 몇 가지 내게 전화 할 수 있니? 나는 그것의 ddl만큼 오래 상관하지 않을 것이다. –

0

변환을 위해 Open Office를 자동화하는 것이 좋습니다. 무료이며 내 경험에 따라 까지은 자동화 된 변환 작업에 사용될 때 Microsoft Office보다 안정적입니다.

유사한 질문에 대한 답변보기 here, 코드 샘플이 포함되어 있습니다.

관련 문제