2015-01-13 1 views
0

iTextSharp 라이브러리를 사용하여 .jpg 파일을 PDF로 변환하려고합니다. 나는이 라인에서 오류가 발생하고,.jpg to .pdf 변환 - iTextSharp.text.PageSize '가 Windows Phone 8.1에서 예외를 throw했습니다.

using (MemoryStream newStream = new MemoryStream()) 
{ 
    Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4.Rotate());      
    PdfWriter writer = PdfWriter.GetInstance(doc, newStream); 
    writer.CloseStream = false; 

    byte[] all = newStream.ToArray(); 
} 

:하지만

Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4.Rotate()); 

나는 점점 오전 오류를 다음과 같이 :

아래 내 코드를 참조

메시지를 =는 " 'iTextSharp.text.PageSize'의 형식 이니셜 라이저에서 예외가 발생했습니다. " InnerException = {System.IO.FileNotFoundException : 'System.Drawing, Version = 1.0.5000.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'또는 종속성 중 하나를로드 할 수 없습니다. 시스템이 지정된 파일을 찾을 수 없습니다.

어떻게 처리할까요? 감사합니다.

+0

이 게시물에 당신을 도울 수 있습니다 - http://stackoverflow.com/questions/21827669/jpg-to-pdf-conversion-in-windows-phone-8-app –

답변

0

마지막으로 나는 길을 발견했다. Windows Phone 8.1 Project에 ComponentOne Library를 추가했습니다.

using C1.Phone.Pdf; 
using C1.Phone.PdfViewer; 

C1PdfDocument pdf = new C1PdfDocument(PaperKind.PrcEnvelopeNumber3Rotated); 
pdf.Landscape = true; 

var rc = new System.Windows.Rect(20,30,300,200); 
pdf.DrawImage(wbitmp, rc); 

var fillingName = "Test.pdf"; 
var gettingFile = IsolatedStorageFile.GetUserStoreForApplication(); 

using (var loadingFinalStream = gettingFile.CreateFile(fillingName)) 
{ 
    pdf.Save(loadingFinalStream); 
} 
+0

어떻게 작동합니까? 그것은 나를 위해 작동하지 않았다? 그거 실버 라이트 야? – Amin

+0

@Amin 예 실버 라이트 야! –

1

iTextsharp는 (아직) Windows phone을 지원하지 않습니다. 당신이 겪고있는 문제 중 하나는 System.Drawaing이 Windows phone에는 존재하지 않지만 다른 곳에서는 실패 할 것이라는 점입니다. Windows 전화 지원 어셈블리 here 목록이 있습니다.

+0

수있는 시스템'없이 iTextSharp의 버전 .Drawing'이 사용됩니까? –

+0

그래서 사용하지 않아도됩니다 !! 젠장 창 전화! Thanx @Paulo –

+0

@ChrisHaas : System.Drawing뿐만 아니라 모든 파일 관리가 변경되어야하며 다른 많은 부분이 필요합니다. –

관련 문제