IronPDF トラブルシューティング PDFをBase64に変換 PDFをBase64に変換する カーティス・チャウ 更新日:6月 9, 2025 IronPDF をダウンロード NuGet ダウンロード DLL ダウンロード Windows 版 無料トライアル LLM向けのコピー LLM向けのコピー LLM 用の Markdown としてページをコピーする ChatGPTで開く このページについてChatGPTに質問する ジェミニで開く このページについてGeminiに問い合わせる ジェミニで開く このページについてGeminiに問い合わせる 困惑の中で開く このページについてPerplexityに問い合わせる 共有する Facebook で共有 Xでシェア(Twitter) LinkedIn で共有 URLをコピー 記事をメールで送る This article was translated from English: Does it need improvement? Translated View the article in English どのようにPDFをBase64に変換できますか? PdfDocument オブジェクトには直接Base64を取得するためのプロパティはありません。ただし、バイト配列を取得することができ、その後それを用いてBase64文字列を得ることができます。 using System; using SomePdfLibrary; // Make sure to import the library used for handling PDF files class Program { static void Main() { // Create a PdfDocument object for the specified PDF file var pdf = new PdfDocument("MyPDF.pdf"); // Get the binary data (byte array) from the PDF document var byteArray = pdf.BinaryData; // Convert the byte array to a Base64 string var base64Result = Convert.ToBase64String(byteArray); // Output the Base64 result Console.WriteLine("Base64 of PDF: " + base64Result); } } using System; using SomePdfLibrary; // Make sure to import the library used for handling PDF files class Program { static void Main() { // Create a PdfDocument object for the specified PDF file var pdf = new PdfDocument("MyPDF.pdf"); // Get the binary data (byte array) from the PDF document var byteArray = pdf.BinaryData; // Convert the byte array to a Base64 string var base64Result = Convert.ToBase64String(byteArray); // Output the Base64 result Console.WriteLine("Base64 of PDF: " + base64Result); } } Imports System Imports SomePdfLibrary ' Make sure to import the library used for handling PDF files Friend Class Program Shared Sub Main() ' Create a PdfDocument object for the specified PDF file Dim pdf = New PdfDocument("MyPDF.pdf") ' Get the binary data (byte array) from the PDF document Dim byteArray = pdf.BinaryData ' Convert the byte array to a Base64 string Dim base64Result = Convert.ToBase64String(byteArray) ' Output the Base64 result Console.WriteLine("Base64 of PDF: " & base64Result) End Sub End Class $vbLabelText $csharpLabel 説明: PdfDocument 初期化: 変換したいPDFのファイル名で PdfDocument オブジェクトを初期化します。 SomePdfLibrary を使用している実際のライブラリに置き換えてください。 BinaryData 取得: 指定されたPDFのバイナリデータ(バイト配列として)を取得します。 Base64変換: Convert.ToBase64String メソッドを使用してバイト配列をBase64文字列に変換します。 出力Base64文字列: Base64エンコードされた文字列を検証のためにコンソールに出力します。 カーティス・チャウ 今すぐエンジニアリングチームとチャット テクニカルライター Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。 準備はできましたか? Nuget ダウンロード 16,493,056 | Version: 2025.11 リリース NuGet 無料版 総ダウンロード数: 16,493,056 ライセンスを見る