圧縮フォルダを解凍する。画像が複数含まれるので分割する。フォルダごとにpdfに変換
pdf作成
@@ -24,6 +24,7 @@ | ||
24 | 24 | Private Sub InitializeComponent() |
25 | 25 | Me.btnExecute = New System.Windows.Forms.Button() |
26 | 26 | Me.TextBox1 = New System.Windows.Forms.TextBox() |
27 | + Me.lstLog = New System.Windows.Forms.ListBox() | |
27 | 28 | Me.SuspendLayout() |
28 | 29 | ' |
29 | 30 | 'btnExecute |
@@ -43,11 +44,21 @@ | ||
43 | 44 | Me.TextBox1.TabIndex = 1 |
44 | 45 | Me.TextBox1.Text = "D:\ZIP\(一般コミック) [横山光輝] 三国志 全60巻" |
45 | 46 | ' |
47 | + 'lstLog | |
48 | + ' | |
49 | + Me.lstLog.FormattingEnabled = True | |
50 | + Me.lstLog.ItemHeight = 12 | |
51 | + Me.lstLog.Location = New System.Drawing.Point(41, 128) | |
52 | + Me.lstLog.Name = "lstLog" | |
53 | + Me.lstLog.Size = New System.Drawing.Size(120, 88) | |
54 | + Me.lstLog.TabIndex = 2 | |
55 | + ' | |
46 | 56 | 'Form1 |
47 | 57 | ' |
48 | 58 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) |
49 | 59 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font |
50 | 60 | Me.ClientSize = New System.Drawing.Size(600, 261) |
61 | + Me.Controls.Add(Me.lstLog) | |
51 | 62 | Me.Controls.Add(Me.TextBox1) |
52 | 63 | Me.Controls.Add(Me.btnExecute) |
53 | 64 | Me.Name = "Form1" |
@@ -59,4 +70,5 @@ | ||
59 | 70 | |
60 | 71 | Friend WithEvents btnExecute As Button |
61 | 72 | Friend WithEvents TextBox1 As TextBox |
73 | + Friend WithEvents lstLog As ListBox | |
62 | 74 | End Class |
@@ -1,5 +1,10 @@ | ||
1 | -Public Class Form1 | |
1 | +Imports System.IO, com | |
2 | +Imports iTextSharp.text.pdf | |
3 | +Imports iTextSharp.text | |
4 | + | |
5 | +Public Class Form1 | |
2 | 6 | Private Sub btnExecute_Click(sender As Object, e As EventArgs) Handles btnExecute.Click |
7 | + lstLog.Items.Add("処理開始") | |
3 | 8 | Dim allPath = TextBox1.Text '全冊フォルダ |
4 | 9 | '全冊フォルダのzipファイルを列挙するし以下を繰り返す。 |
5 | 10 | 'tempフォルダがあれば削除する。 |
@@ -12,6 +17,17 @@ | ||
12 | 17 | '2番目以降のファイルを読み込む。 |
13 | 18 | '2つに分割し右側をfilename_count.jpeg,左側をfilename_count+1.jpegとして保存する |
14 | 19 | 'tempフォルダをpdf化する |
15 | - | |
20 | + 'A4サイズを横向きで | |
21 | + Dim pdfDocument = New Document(PageSize.A4.Rotate(), 0, 0, 0, 0) | |
22 | + '出力先のファイル名 | |
23 | + Dim makePdfFilePath = "d:\test.pdf" | |
24 | + Dim fileStream = New FileStream(makePdfFilePath, FileMode.Create) | |
25 | + Dim writer = PdfWriter.GetInstance(pdfDocument, fileStream) | |
26 | + 'PDFドキュメントを開く | |
27 | + pdfDocument.Open() | |
28 | + pdfDocument.Add(New Paragraph("test")) | |
29 | + 'PDFドキュメントを閉じる | |
30 | + pdfDocument.Close() | |
31 | + lstLog.Items.Add("処理終了") | |
16 | 32 | End Sub |
17 | 33 | End Class |