개발/C#

C# Html to pdf 변환

FA1976 2018. 11. 20. 09:13

            //HtmlConverter.ConvertToPdf(    new FileInfo(@"C:\Temp\sample_utf8.html"),    new FileInfo(@"C:\Temp\sample.pdf") );

            Microsoft.Office.Interop.Word.Application word =  new Microsoft.Office.Interop.Word.Application();

            Microsoft.Office.Interop.Word.Document wordDoc =  new Microsoft.Office.Interop.Word.Document();

            Object oMissing = System.Reflection.Missing.Value;

            wordDoc = word.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);

            word.Visible = false;

            Object filepath = @"C:\Temp\sample.html";

            Object confirmconversion = System.Reflection.Missing.Value;

            Object readOnly = false;

            Object saveto = @"C:\Temp\sample.pdf";

            Object oallowsubstitution = System.Reflection.Missing.Value;


            wordDoc = word.Documents.Open(ref filepath, ref confirmconversion,

                                            ref readOnly, 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);

            object fileFormat = WdSaveFormat.wdFormatPDF;

            wordDoc.SaveAs(ref saveto, 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 oallowsubstitution, ref oMissing,

                                ref oMissing);


'개발 > C#' 카테고리의 다른 글

C# [미디어] 코덱  (0) 2019.04.23
C# 대용량 파일에서 마지막 라인 읽기  (0) 2019.04.10
C# [시스템] delay 함수  (0) 2019.03.23
C# [정규식] 문자열 추출  (0) 2019.03.21
C# 웹브라우저 메모리 누수  (0) 2018.06.08
C# 델리게이트  (0) 2018.05.24
[그래프] C# 속도계 (Gage)  (0) 2018.04.25
[그래프] C# 실시간 그래프  (2) 2018.04.25