200K を超える画像を含むフォルダーがあります。一部の画像は、以下のファイル名のパターンに従います。
5093_1.jpg
5093_2.jpg
5093_3.jpg
5093_4.jpg
5093_5.jpg
5094_1.jpg
5094_2.jpg
5094_3.jpg
私の計画は、iTextSharp を使用して各画像セットを PDF にマージすることです。画像のセットと言うと、以下のもの
5093_1.jpg
5093_2.jpg
5093_3.jpg
5093_4.jpg
5093_5.jpg
5093.pdfと残りの5094.pdfになります。
以下のようなもの
iTextSharp.text.Document Doc = new iTextSharp.text.Document(PageSize.LETTER);
//Store the document on the desktop
string PDFOutput = Path.Combine(PDFFolder, "PDFs", tmp[0] + "_" + tmp[1].Replace(".jpg", "") + ".pdf");
PdfWriter writer = PdfWriter.GetInstance(Doc, new FileStream(PDFOutput, FileMode.Create, FileAccess.Write, FileShare.Read));
//Open the PDF for writing
Doc.Open();
Doc.NewPage();
//Doc.Add(new iTextSharp.text.Jpeg(new Uri(fi.FullName)));
Image jpg = Image.GetInstance(new Uri(fi.FullName));
jpg.ScaleToFit(700f, 700f);
Doc.Add(jpg);
Doc.Close();
皆さんへの私の質問は、5093 または任意の番号のすべてのファイルを順番に見つけて、ループして PDF としてステッチできるようにすることです。
助けてくれてありがとう