• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

圧縮フォルダを解凍する。画像が複数含まれるので分割する。フォルダごとにpdfに変換


コミットメタ情報

リビジョン5 (tree)
日時2017-09-10 11:43:03
作者bellyoshi

ログメッセージ

とりあえず完成

変更サマリ

差分

--- WindowsApp1/WindowsApp1/AppTempDir.vb (revision 4)
+++ WindowsApp1/WindowsApp1/AppTempDir.vb (revision 5)
@@ -17,7 +17,7 @@
1717 End Sub
1818
1919 Private Sub IDisposable_Dispose() Implements IDisposable.Dispose
20- ' IfExistDirDelete(Path)
20+ 'todo:後片付け IfExistDirDelete(Path)
2121 End Sub
2222
2323 ''' <summary>
--- WindowsApp1/WindowsApp1/Form1.Designer.vb (revision 4)
+++ WindowsApp1/WindowsApp1/Form1.Designer.vb (revision 5)
@@ -29,9 +29,10 @@
2929 '
3030 'btnExecute
3131 '
32- Me.btnExecute.Location = New System.Drawing.Point(41, 81)
32+ Me.btnExecute.Location = New System.Drawing.Point(55, 101)
33+ Me.btnExecute.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
3334 Me.btnExecute.Name = "btnExecute"
34- Me.btnExecute.Size = New System.Drawing.Size(75, 23)
35+ Me.btnExecute.Size = New System.Drawing.Size(100, 29)
3536 Me.btnExecute.TabIndex = 0
3637 Me.btnExecute.Text = "実行"
3738 Me.btnExecute.UseVisualStyleBackColor = True
@@ -38,9 +39,10 @@
3839 '
3940 'TextBox1
4041 '
41- Me.TextBox1.Location = New System.Drawing.Point(41, 40)
42+ Me.TextBox1.Location = New System.Drawing.Point(55, 50)
43+ Me.TextBox1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
4244 Me.TextBox1.Name = "TextBox1"
43- Me.TextBox1.Size = New System.Drawing.Size(483, 19)
45+ Me.TextBox1.Size = New System.Drawing.Size(643, 22)
4446 Me.TextBox1.TabIndex = 1
4547 Me.TextBox1.Text = "D:\ZIP\(一般コミック) [横山光輝] 三国志 全60巻"
4648 '
@@ -47,20 +49,23 @@
4749 'lstLog
4850 '
4951 Me.lstLog.FormattingEnabled = True
50- Me.lstLog.ItemHeight = 12
51- Me.lstLog.Location = New System.Drawing.Point(41, 128)
52+ Me.lstLog.ItemHeight = 15
53+ Me.lstLog.Location = New System.Drawing.Point(25, 156)
54+ Me.lstLog.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
5255 Me.lstLog.Name = "lstLog"
53- Me.lstLog.Size = New System.Drawing.Size(120, 88)
56+ Me.lstLog.ScrollAlwaysVisible = True
57+ Me.lstLog.Size = New System.Drawing.Size(696, 349)
5458 Me.lstLog.TabIndex = 2
5559 '
5660 'Form1
5761 '
58- Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
62+ Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
5963 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
60- Me.ClientSize = New System.Drawing.Size(600, 261)
64+ Me.ClientSize = New System.Drawing.Size(800, 567)
6165 Me.Controls.Add(Me.lstLog)
6266 Me.Controls.Add(Me.TextBox1)
6367 Me.Controls.Add(Me.btnExecute)
68+ Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
6469 Me.Name = "Form1"
6570 Me.Text = "Form1"
6671 Me.ResumeLayout(False)
--- WindowsApp1/WindowsApp1/Form1.vb (revision 4)
+++ WindowsApp1/WindowsApp1/Form1.vb (revision 5)
@@ -24,10 +24,10 @@
2424 Dim allPath = TextBox1.Text '全冊フォルダ
2525 '全冊フォルダのzipファイルを列挙するし以下を繰り返す。
2626 Dim files As String() = System.IO.Directory.GetFiles(allPath, "*.zip", System.IO.SearchOption.AllDirectories)
27- If 0 < files.Count Then
28- Dim zipFilePath = files(0) 'todo:test用とりあえず一個だけ試す。
27+ For Each zipFilePath In files
28+ log.Info(zipFilePath)
2929 zipToPdf(zipFilePath)
30- End If
30+ Next
3131
3232 log.Info("処理終了")
3333 End Sub
@@ -52,7 +52,8 @@
5252
5353 '解凍処理
5454 System.IO.Compression.ZipFile.ExtractToDirectory(zipFilePath, srcFiles.Path)
55-
55+ Dim width As Integer
56+ Dim height As Integer
5657 filename_count = 1
5758 'tempフォルダのjpegファイルを列挙し以下を繰り返す
5859 Dim files As String() = System.IO.Directory.GetFiles(srcFiles.Path, "*.jpg", System.IO.SearchOption.AllDirectories)
@@ -65,8 +66,8 @@
6566 '左側画像を保存する。
6667 Else
6768 Dim image As New Bitmap(filepath)
68- Dim width As Integer = image.Width / 2
69- Dim height As Integer = image.Height
69+ width = image.Width / 2
70+ height = image.Height
7071 Dim desRect As New Drawing.Rectangle(0, 0, width, height)
7172 Dim destImage As New Bitmap(width, height)
7273 Dim g = Graphics.FromImage(destImage)
@@ -86,7 +87,8 @@
8687 '2つに分割し右側をfilename_count.jpeg,左側をfilename_count+1.jpegとして保存する
8788 'tempフォルダをpdf化する
8889 'A4サイズを横向きで
89- Dim pdfDocument = New Document(PageSize.A4.Rotate(), 0, 0, 0, 0)
90+ Dim psize As New iTextSharp.text.Rectangle(Width, Height)
91+ Dim pdfDocument = New Document(psize, 0, 0, 0, 0)
9092 '出力先のファイル名
9193 Dim makePdfFilePath = zipFilePath.Replace(".zip", "pdf")
9294 Dim fileStream = New FileStream(makePdfFilePath, FileMode.Create)
@@ -93,7 +95,11 @@
9395 Dim writer = PdfWriter.GetInstance(pdfDocument, fileStream)
9496 'PDFドキュメントを開く
9597 pdfDocument.Open()
96- pdfDocument.Add(New Paragraph("test"))
98+ files = System.IO.Directory.GetFiles(tempFiles.Path, "*.jpg", System.IO.SearchOption.AllDirectories)
99+ For Each filepath As String In files
100+ Dim img = iTextSharp.text.Image.GetInstance(New Uri(filepath))
101+ pdfDocument.Add(img)
102+ Next
97103 'PDFドキュメントを閉じる
98104 pdfDocument.Close()
99105