나는 몇 가지 오픈 소스 / 프리웨어 프로그램 .doc 파일을 찾을 수 있도록 하고 있지만, 모든 변환하십시오 .pdf 파일을 다양한 애플리케이션 및 프린터 드라이버를 they& # 39 SDK 없이 첨부됩니다.
내가 가지고 있는 여러 프로그램을 .doc 파일을 찾을 수 있도록 SDK 를 .pdf 파일을 변환할 수 있지만, 모든 독점 라이센스 또는 $2,000 they& # 39, re 유형, 그 당시.
아는 사람, 프로그램 내 문제 해결 방법을 사용하여 모든 청소하십시오 저렴한 (대부분 무료), C #, VB.NET?
감사합니다!
It for 루프는 루프 대신 포리치 사용하여 이 문제를 해결했다.
int j = 0;
foreach (Microsoft.Office.Interop.Word.Page p in pane.Pages)
{
var bits = p.EnhMetaFileBits;
var target = path1 +j.ToString()+ "_image.doc";
try
{
using (var ms = new MemoryStream((byte[])(bits)))
{
var image = System.Drawing.Image.FromStream(ms);
var pngTarget = Path.ChangeExtension(target, "png");
image.Save(pngTarget, System.Drawing.Imaging.ImageFormat.Png);
}
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
j++;
}
이것은 수정 가져다줄래요 협력했습니다 프로그램입니다. It 가 Word 2007년 에 [PDF 로 저장할 추가] [1] 설치되었음. Doc 파일, 그들을 위한 디렉터리입니다 열었든 word 에서 검색한 후 솔리드로 절약합니다 pdf. 참고로, ll 추가해야 할 참조입니다 마이크로소프트리프리스트린트로피워드 you& # 39 이 솔루션은.
using Microsoft.Office.Interop.Word;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
...
// Create a new Microsoft Word application object
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
// C# doesn't have optional arguments so we'll need a dummy value
object oMissing = System.Reflection.Missing.Value;
// Get list of Word files in specified directory
DirectoryInfo dirInfo = new DirectoryInfo(@"\\server\folder");
FileInfo[] wordFiles = dirInfo.GetFiles("*.doc");
word.Visible = false;
word.ScreenUpdating = false;
foreach (FileInfo wordFile in wordFiles)
{
// Cast as Object for word Open method
Object filename = (Object)wordFile.FullName;
// Use the dummy value as a placeholder for optional arguments
Document doc = word.Documents.Open(ref filename, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
doc.Activate();
object outputFileName = wordFile.FullName.Replace(".doc", ".pdf");
object fileFormat = WdSaveFormat.wdFormatPDF;
// Save document into PDF Format
doc.SaveAs(ref outputFileName,
ref fileFormat, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
// Close the Word document, but leave the Word application open.
// doc has to be cast to type _Document so that it will find the
// correct Close method.
object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
((_Document)doc).Close(ref saveChanges, ref oMissing, ref oMissing);
doc = null;
}
// word has to be cast to type _Application so that it will find
// the correct Quit method.
((_Application)word).Quit(ref oMissing, ref oMissing, ref oMissing);
word = null;
[1]: http://www.microsoft.com/downloads/details.aspx =, = en 디스플레랑 4d951911-3e7e-4ae6-b059-a2e79ed87041& 파밀리이드?
요약하자면, it up for vb.net 사용자의 사용 가능한 옵션 (office 가 설치되어 있어야):
Microsoft office 아서 비스 다운로드하십시오:
[피아 for office 2010년] [1]
[피아 for office 2007년] [2]
추가 참조입니다 마이크로소프트리프리스트린트로피워드리아프리카션
추가 사용 또는 가져오기의 (vb.net) 통해 마이크로소프트리프리스트린트로피워드리아프리카션
VB.NET 예제:
Dim word As Application = New Application()
Dim doc As Document = word.Documents.Open("c:\document.docx")
doc.Activate()
doc.SaveAs2("c:\document.pdf", WdSaveFormat.wdFormatPDF)
doc.Close()
[1]: https://www.microsoft.com/en-us/download/details.aspx 3508? id = [2]: https://www.microsoft.com/en-us/download/details.aspx 18346? id =
페드프크레이터 는 COM 컴포넌트, 호출 또는 .net 과 vb 스크립트 (포함된 샘플링합니다 다운로드하십시오).
하지만 내게 필요한 것은 무엇인가 하는 것 같다 - 그냥 프린터를 통해 이러한 혼합 Word& # 39 의 자동화, 진실이며당신이 제공하십시오 상황보고해 움직일만 합니다.
그냥 제가 하고 싶은 사용할 수 있는 기능을 추가, 특히 이 문서에 사용된 스레드할 마이크로소프트리안테로프 라이브러리보다는 에스파르타스피셰드포르마 내가 보지 못했다.
using Microsoft.Office.Interop.Word;
using System.Runtime.InteropServices;
using System.IO;
using Microsoft.Office.Core;Application app;
public string CreatePDF(string path, string exportDir)
{
Application app = new Application();
app.DisplayAlerts = WdAlertLevel.wdAlertsNone;
app.Visible = true;
var objPresSet = app.Documents;
var objPres = objPresSet.Open(path, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
var pdfFileName = Path.ChangeExtension(path, ".pdf");
var pdfPath = Path.Combine(exportDir, pdfFileName);
try
{
objPres.ExportAsFixedFormat(
pdfPath,
WdExportFormat.wdExportFormatPDF,
false,
WdExportOptimizeFor.wdExportOptimizeForPrint,
WdExportRange.wdExportAllDocument
);
}
catch
{
pdfPath = null;
}
finally
{
objPres.Close();
}
return pdfPath;
}
[1]: joel.3.533855.12 http://discuss.joelonsoftware.com/default.asp? [2]: 조엘 http://discuss.joelonsoftware.com/default.asp?
누군가 나에게 10000mb word 파일을 PDF 로 갔던 말씀을 통해 PDF 로 변환할 때 통증을 덤프했습니다. 난 이제 그것을했다 C # 의 호환 PC 를 이용할 경우 그 당시 사용된 단어 및 속도 저하, 크래시되었습니다 전혀 찾았다. 답답한 것은 매우.
내가 할 수 있는 이 저로하여금진실의 덤프합니다 interop 검색 및 그 느림. excel 위해 내가 할 수 있는 무료 툴을 사용 (에프라우스) 한 후 우리 사회의 첨탑 불렀으매 수 있는 PDF 로 변환. 함께 한계에는!
http://www.e-iceblue.com/Introduce/free-doc-component.html # .VtAg4PmLRhE
여기에 정보를 일부 관련됩니까 것으로 보인다.
https://stackoverflow.com/questions/159744/converting-ms-word-documents-to-pdf-in-asp-net
또한, 오피스 2007년 이 기능을 사용할 수 있는 PDF 로 제작, 뭐 사무자동화 및 PDF 로 저장할 수 있는 파일을 Word 2007년 *.DOC 엽니다. # 39 에 대한 관심이 고조되는 it& i& 너무 느리고, s # 39 m not, 사무자동화 등 취약 내어쓰기는 한 것이 아니라, 그 밖에 던진다.
Microsoft word PDF 용 추가 될 가능성이 높은 것으로 가장 적합한 솔루션을 확장하지만 이제 모든 단어 문서를 pdf 로 변환 고려해야 할 수 없는 경우에 따라 큰 차이를 제대로 볼 수 있습니다 다음 단어 및 출력물에는 pdf. # 39, 내가 하는 모든 워드 문서 변환 t 죄송합니다. couldn& apiu 찾을 것입니다. 내가 찾은 유일한 변환 솔루션 확보를 위해 100% 가 프린터 드라이버를 통한 문서 변환 올바른 두고 있었다. 그러나 대기됩니다 에로남이네 문서 및 변환된 하나씩 확인할 수 있습니다 다음 단어 문서를 pdf 는 레이아웃용 확장하지만 동일하게 되었다. 개인적으로 선호하는 폭스잇 리더 (무료 버전) 를 사용하여 데스 (Universal 문서 converter) 및 설치된 서버에 너무 인쇄했습니다 시작하여, 다음 문서를 " Process". 동사 및 설정하기 위해 재산을 print" ";). 설정할 때 신호 변환 완료된 피레시스템워처 사용할 수도 있습니다.
using Word = Microsoft.Office.Interop.Word;
private void convertDOCtoPDF()
{
object misValue = System.Reflection.Missing.Value;
String PATH_APP_PDF = @"c:\..\MY_WORD_DOCUMENT.pdf"
var WORD = new Word.Application();
Word.Document doc = WORD.Documents.Open(@"c:\..\MY_WORD_DOCUMENT.docx");
doc.Activate();
doc.SaveAs2(@PATH_APP_PDF, Word.WdSaveFormat.wdFormatPDF, misValue, misValue, misValue,
misValue, misValue, misValue, misValue, misValue, misValue, misValue);
doc.Close();
WORD.Quit();
releaseObject(doc);
releaseObject(WORD);
}
private void releaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch (Exception ex)
{
//TODO
}
finally
{
GC.Collect();
}
}