0
C#の注釈機能を使用してPDFを開くか作成するサンプルを表示したいどのようにPDFを描画するか、PDFを開いてC#のウィンドウの電話プログラミングで注釈を追加するには?
C#の注釈機能を使用してPDFを開くか作成するサンプルを表示したいどのようにPDFを描画するか、PDFを開いてC#のウィンドウの電話プログラミングで注釈を追加するには?
.NET FrameworkにはAPIが含まれていないため、Windows PhoneでPDFファイルを作成するにはサードパーティライブラリが必要ですPDFファイルを扱う
次のコードは、PDFファイルを作成し、XFINIUM.PDFライブラリを使用して、それにテキスト注釈を追加する方法を示しています。
// Create a new document and add a page to it
PdfFixedDocument document = new PdfFixedDocument();
PdfPage page = document.Pages.Add();
// Create the text annotation and set its properties.
PdfTextAnnotation ta = new PdfTextAnnotation();
ta.Author = "John Doe";
ta.Contents = "I am a text annotation.";
ta.IconName = "Note";
// Add the annotation to the page
page.Annotations.Add(ta);
ta.Location = new PdfPoint(50, 50);
// Save the document
// Get a local folder for the application.
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
StorageFile pdfFile = await storageFolder.CreateFileAsync("sample.pdf", CreationCollisionOption.ReplaceExisting);
var pdfStream = await pdfFile.OpenAsync(FileAccessMode.ReadWrite);
// Convert the random access stream to a .NET Stream and save the document.
using (Stream stm = pdfStream.AsStream())
{
document.Save(stm);
await stm.FlushAsync();
}
pdfStream.Dispose();
MessageDialog messageDialog = new MessageDialog("File(s) saved with success to application's local folder.");
await messageDialog.ShowAsync();
免責事項:私はXFINIUM.PDFライブラリを開発する会社のために働きます。
なぜアップワイヤー? SOはコーディングサービスではありません。あなたがこれまでに試したことを私たちに教えてください。 –
@diiN_私はそれが私が求めていることを知らない。 – zombie