私は必要以上に多くのデータを含むツリーノートからデータを転送しようとしています(少なくともそれはそうだと思います)。 treenode内のデータを操作するのは非常に困難です。私はむしろ、データ操作に必要なデータだけを提供する配列を持っています。ツリーノード変数から配列と塗りつぶしを作成する方法
私は希望より高いレート持って次の変数: 1. BookmarkNumber(整数) 2日(文字列) 3のDocumentType(文字列) 4. BookmarkPageNumberString(文字列) 5. BookmarkPageNumberInteger(整数)
私は変数book_markからのデータから上記の定義されたレートを望みます(私のコードに見られるように)。
私はこれを2日間続けています。どんな助けでも大歓迎です。私はおそらく、質問が正しく表現されていないと確信していますので、必要に応じてさらに説明できるように質問してください。そんなに
おかげ
ところで、私が正しいでブックマークを保存しながら、それぞれのブックマーク/チャプターのための個別のPDFファイルに複数のブックマークを持っているPDFファイルを解析し、Windowsフォームのプログラムを作成されてやろうとしていますフォルダの名前と命名規則は、解析されているブックマーク/チャプタのPDF名とタイトル名に依存します。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using itextsharp.pdfa;
using iTextSharp.awt;
using iTextSharp.testutils;
using iTextSharp.text;
using iTextSharp.xmp;
using iTextSharp.xtra;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void ChooseImageFileWrapper_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = GlobalVariables.InitialDirectory;
openFileDialog1.Filter = "Pdf Files|*.pdf";
openFileDialog1.RestoreDirectory = true;
openFileDialog1.Title = "Image File Wrapper Chooser";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
GlobalVariables.ImageFileWrapperPath = openFileDialog1.FileName;
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
ImageFileWrapperPath.Text = GlobalVariables.ImageFileWrapperPath;
}
private void ImageFileWrapperPath_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
iTextSharp.text.pdf.PdfReader pdfReader = new iTextSharp.text.pdf.PdfReader(GlobalVariables.ImageFileWrapperPath);
IList<Dictionary<string, object>> book_mark = iTextSharp.text.pdf.SimpleBookmark.GetBookmark(pdfReader);
List<ImageFileWrapperBookmarks> IFWBookmarks = new List<ImageFileWrapperBookmarks>();
foreach (Dictionary<string, object> bk in book_mark) // bk is a single instance of book_mark
{
ImageFileWrapperBookmarks.BookmarkNumber = ImageFileWrapperBookmarks.BookmarkNumber + 1;
foreach (KeyValuePair<string, object> kvr in bk) // kvr is the key/value in bk
{
if (kvr.Key == "Kids" || kvr.Key == "kids")
{
//create recursive program for children
}
else if (kvr.Key == "Title" || kvr.Key == "title")
{
}
else if (kvr.Key == "Page" || kvr.Key == "page")
{
}
}
}
MessageBox.Show(GlobalVariables.ImageFileWrapperPath);
}
}
}