2012-01-16 14 views
4

私はPDFに画像をエクスポートする必要があるプロジェクトがあります。 pdfにエクスポートするには、イメージとテキストが必要です。 silverPDF.dllとPdfReaderを使ってこれを行う方法はありますか?画像をPDFにエクスポート

ここにコードします。

private void btnOutlook_Click(object sender, System.Windows.RoutedEventArgs e) 
    { 
     XBrush xbrush; 
     SaveFileDialog savePDF = new SaveFileDialog(); 
     savePDF.Filter = "PDF file format | *.pdf"; 
     if (savePDF.ShowDialog() == true) 
     { 
      PdfDocument document = new PdfDocument(); 
      PdfPage page = document.AddPage(); 
      XGraphics gfx = XGraphics.FromPdfPage(page); 
      XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always); 

      XFont font = new XFont("Huxtable", 20, XFontStyle.Bold, options); 

      for (int x = 0; x < 10; x++) 
      { 
       if (x % 2 == 0) 
       { 
        xbrush = XBrushes.Red; 
       } 
       else 
        xbrush = XBrushes.Black; 
       gfx.DrawString(string.Format("{0}", stringArray[x]), font, xbrush, new XRect(0, (x * 20), page.Width, page.Height), XStringFormats.TopLeft); 
      } 

      document.Save(savePDF.OpenFile()); 
     } 

    } 

このコードでは、このコードに画像を挿入してpdfに挿入できますか?何か方法はありますか?すべての返信をありがとう。

+0

(そうでない場合、私は、サンプルコードを貼り付けただろう)iTextSharpライブラリを使用して、私の以前の雇用主で前に似た何かを行ったように私はSilverPDFについて何を知っているが存在しません他のユーティリティクラスを使用してオンラインでいくつかのチュートリアル。 [Here's](http://forums.asp.net/t/1348035.aspx/1)です。 –

答えて

1

SilverPDFが必要ですか? Iv'eが

iTextSharp-Working-with-images

Download Link

+0

私はそれらを使用することはできませんが、Silverlightランタイムに対してビルドされていません。私のために巨大な問題。 – Nathan

+1

私は今それらを使用しています。私はちょうど.Webアプリケーションでプロジェクトを作成し、保存するためにバイトでSilverlightアプリケーションに渡しました。助けてくれてありがとう! – Nathan

関連する問題