Ini mungkin bukan solusi yang Anda cari:
Anda dapat menggunakan, misalnya, LaTeX untuk mencapai ini. Anda perlu membuat file TeX dengan cara lain, misalnya, bahasa pemrograman favorit Anda. Ini mengharuskan Anda untuk mengetahui cara memprogram, menggunakan LaTeX dan, tentu saja, menginstal alat yang diperlukan.
Jika Anda tertarik, saya bisa menguraikan hal ini dan menambahkan skrip sampel.
Sunting:
Saya membuat program FreeBASIC kecil (agak kotor tetapi melakukan pekerjaan) untuk menghasilkan file .tex. Ini kemudian dapat digunakan untuk menghasilkan file pdf akhir dengan, misalnya, Miktex dan TexnicCenter.
- Unduh dan ekstrak kompiler FreeBASIC dari http://www.freebasic.net/ (saya menggunakan
FreeBASIC-1.05.0-win64.zip
).
- Simpan kode di bawah ini sebagai, katakan
code.bas
, dan kompilasi dengan fbc.exe code.bas
.
- Seret dan lepas folder "Laporkan 1", "Laporkan 2" dll. Ke folder yang dapat dieksekusi baru
code.exe
. Ini akan menghasilkan file "Laporkan 1.tex", "Laporkan 2.tex" di folder masing-masing.
- Unduh dan instal Miktex dari http://www.miktex.org/ (aktifkan instalasi paket langsung saat setup) dan TexnicCenter dari http://www.texniccenter.org/download/ dan buka file laporan di TexnicCenter . Saya tidak yakin apakah Anda perlu melakukan perubahan pada pengaturan default tetapi internet penuh dengan sumber daya untuk ini. Saat mengompilasinya
LaTeX -> PDF
harus menginstal paket yang hilang.
Sourcecode: Memproses secara eksplisit struktur folder dan nama file yang disebutkan dan tidak lebih.
' Drag and drop folders onto the executable in order to generate a .tex-file
' which can be used to merge the pdfs in each passed folder using LaTeX.
'
#include "vbcompat.bi"
sub expandEnviron__isFileOrFolder ( byref strPath as string )
dim iLetter as integer
if left(strPath,1)="%" then
for iLetter=2 to len(strPath)
if mid(strPath,iLetter,1)="%" then
strPath=environ(mid(strPath,2,iLetter-2))+right(strPath,len(strPath)-iLetter)
exit for
end if
next iLetter
end if
end sub
function isFileOrFolder ( byref strPath as string, byval expPath as string ptr = 0 ) as integer
' return value:
' 0: path doesn't exist
' 1: file
' 2: folder
'
dim strDir as string = curdir
dim as string strPathCopy
dim as string ptr pPath
if expPath then
*expPath = strPath
expandEnviron__isFileOrFolder(*expPath)
pPath = expPath
else
strPathCopy = strPath
expandEnviron__isFileOrFolder(strPathCopy)
pPath = @strPathCopy
end if
if fileExists(*pPath) then
return 1
elseif ( chdir(*pPath) = 0 ) then
chdir(strDir)
return 2
else
return 0
end if
end function
color(1,15)
cls
if command(1) = "" then
print "Drag and drop folders onto the executable."
sleep
end
end if
dim as string basedir
dim as string strPath = ""
dim as integer i = 1
' Process all command line arguments i.e process all folders.
while command(i) <> ""
basedir = command(i)
dim as string basedirName
' Make sure the argument is indeed a folder.
if isFileOrFolder(basedir,@strPath) = 2 then
if right(strPath,1) = "\" then basedir = left(strPath,len(strPath)-1)
basedirName = right(basedir,len(basedir)-instrrev(basedir,"\"))
print ""
print baseDirName
'
' Print some LaTeX commands.
open basedir+"\"+baseDirName+".tex" for output as #1
print #1, $"\documentclass{scrreprt}"
print #1, $"\usepackage{grffile}"
print #1, $"\usepackage{pdfpages}"
print #1, $"\usepackage{bookmark}"
print #1, $"\hypersetup{pageanchor=false}"
print #1, $"\begin{document}"
print #1, $"\pagestyle{empty}"
print #1, $"\pagenumbering{gobble}"
print #1, "%"
'
' Process contents.pdf.
dim as string tmp = basedir+"\contents.pdf"
if isFileOrFolder(tmp) = 1 then
print #1, $"\includepdf[pages=-]{contents.pdf}"
else
color(12,15):print chr(9);"missing contents.pdf":color(1,15)
end if
'
' Process execsummary.pdf.
tmp = basedir+$"\execsummary.pdf"
if isFileOrFolder(tmp) = 1 then
print #1, $"\includepdf[pages=-]{execsummary.pdf}"
else
color(12,15):print chr(9);"missing execsummary.pdf":color(1,15)
end if
'
' Process all subfolders named "chapter 1", "chapter 2" etc.
' If "chapter 4" exists but "chapter 3" does not, then "chapter 4" and
' all after that will be ignored.
dim as integer chapter_link_cnt = 0
dim as integer j = 1
dim as string nextChapterDir = basedir+$"\chapter "+str(j)
while isFileOrFolder(nextChapterDir) = 2
print #1, "%"
dim as integer k = 1
'
' Process all files named "page 1", "page 2" etc.
dim as string nextPage = nextChapterDir + $"\page "+str(k)+".pdf"
while isFileOrFolder(nextPage) = 1
if k = 1 then
chapter_link_cnt += 1
print #1, $"\includepdf[link,linkname=l";str(chapter_link_cnt); _
",pages=-]{chapter ";str(j);"/page ";str(k);".pdf}"
print #1, $"\bookmark[dest=l";str(chapter_link_cnt); _
".1]{chapter ";str(j);"}"
else
print #1, $"\includepdf[pages=-]{chapter ";str(j);"/page ";str(k);".pdf}"
end if
k += 1
nextPage = nextChapterDir + $"\page "+str(k)+".pdf"
wend
j += 1
nextChapterDir = basedir+$"\chapter "+str(j)
wend
'
print #1, $"\end{document}"
close #1
else
print ""
color(12,15):print "Error (not a folder): ";command(i):color(1,15)
end if
i += 1
wend
print ""
print ""
print "Done."
sleep
Jika Anda ingin menggunakan bahasa yang berbeda (mungkin bisa dilakukan dengan skrip powershell), berikut adalah contoh file tex:
\documentclass{scrreprt}
\usepackage{grffile}
\usepackage{pdfpages}
\usepackage{bookmark}
\hypersetup{pageanchor=false}
\begin{document}
\pagestyle{empty}
\pagenumbering{gobble}
%
\includepdf[pages=-]{contents.pdf}
\includepdf[pages=-]{execsummary.pdf}
%
\includepdf[link,linkname=l1,pages=-]{chapter 1/page 1.pdf}
\bookmark[dest=l1.1]{chapter 1}
\includepdf[pages=-]{chapter 1/page 2.pdf}
%
\includepdf[link,linkname=l2,pages=-]{chapter 2/page 1.pdf}
\bookmark[dest=l2.1]{chapter 2}
\includepdf[pages=-]{chapter 2/page 2.pdf}
%
\includepdf[link,linkname=l3,pages=-]{chapter 3/page 1.pdf}
\bookmark[dest=l3.1]{chapter 3}
\includepdf[pages=-]{chapter 3/page 2.pdf}
\includepdf[pages=-]{chapter 3/page 3.pdf}
\includepdf[pages=-]{chapter 3/page 4.pdf}
\end{document}