Skip to content

Commit

Permalink
first upload
Browse files Browse the repository at this point in the history
  • Loading branch information
perXautomatik committed Oct 7, 2020
1 parent 4f93d1a commit c774a79
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 0 deletions.
Binary file added PdfSharp-gdi.dll
Binary file not shown.
Binary file added PdfSplitt.exe
Binary file not shown.
Binary file added Ps1_To_Exe/Portable/Ps1_To_Exe.exe
Binary file not shown.
Binary file added Ps1_To_Exe/Portable/Ps1_To_Exe_(x64).exe
Binary file not shown.
Binary file added Ps1_To_Exe/Portable/settings
Binary file not shown.
Binary file added Ps1_To_Exe/Ps1_To_Exe_(Installer).exe
Binary file not shown.
21 changes: 21 additions & 0 deletions Ps1_To_Exe/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
License Agreement

Copyright (c) 2018 Fatih Kodak

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Binary file added exeConversionSavefile.session
Binary file not shown.
Binary file added project-SplitPdf.zip
Binary file not shown.
105 changes: 105 additions & 0 deletions splitPdfByBookmarksJoinSameNameAdjecending.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
##[Ps1 To Exe]
##
##NcDBCIWOCzWE8pGP3wFk4Fn9fms5bM7L6IqDwZK36+X8hwvACZcVWURLpi36N0O8S+JfUvEc+tUdWX0=
##Kd3HDZOFADWE8uK1
##Nc3NCtDXThU=
##Kd3HFJGZHWLWoLaVvnQnhQ==
##LM/RF4eFHHGZ7/K1
##K8rLFtDXTiS5
##OsHQCZGeTiiZ4NI=
##OcrLFtDXTiS5
##LM/BD5WYTiiZ4tI=
##McvWDJ+OTiiZ4tI=
##OMvOC56PFnzN8u+VslQ=
##M9jHFoeYB2Hc8u+VslQ=
##PdrWFpmIG2HcofKIo2QX
##OMfRFJyLFzWE8uK1
##KsfMAp/KUzWJ0g==
##OsfOAYaPHGbQvbyVvnQX
##LNzNAIWJGmPcoKHc7Do3uAuO
##LNzNAIWJGnvYv7eVvnQX
##M9zLA5mED3nfu77Q7TV64AuzAgg=
##NcDWAYKED3nfu77Q7TV64AuzAgg=
##OMvRB4KDHmHQvbyVvnQX
##P8HPFJGEFzWE8tI=
##KNzDAJWHD2fS8u+Vgw==
##P8HSHYKDCX3N8u+Vgw==
##LNzLEpGeC3fMu77Ro2k3hQ==
##L97HB5mLAnfMu77Ro2k3hQ==
##P8HPCZWEGmaZ7/K1
##L8/UAdDXTlaDjofG5iZk2Uj8QGN7P/m/vKWs0I6sw8T1+yjYWYooeVBxpTnwDV+pF/cKUJU=
##Kc/BRM3KXhU=
##
##
##fd6a9f26a06ea3bc99616d4851b372ba
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidateScript({
if( $_.Extension -ine ".pdf" ){
throw "The file $($_.FullName) is not a pdf file."
}
if(-not (Test-Path $_.FullName)) {
throw "The file '$($_.FullName)' does not exist!"
}
$true
})]
[System.IO.FileInfo[]]$File
)

try{
Add-Type -LiteralPath ".\PdfSharp-gdi.dll"
} catch {
throw $Error
}

$DestinationFile = $file | Split-Path -Parent

if((Test-Path $DestinationFile) -and $DestinationFile.IsReadOnly -and -not $Force) {
throw "Destination file '$($DestinationFile.FullName)' is read only"
}

[System.IO.DirectoryInfo]$DestinationDirectory = $DestinationFile
if(-not (Test-Path $DestinationDirectory)) {
try {
$DestinationDirectory = New-Item -Path $DestinationDirectory -ItemType Directory -Force:$Force
} catch {
throw "Error in $($MyInvocation.MyCommand.Name). Could not create directory '$($Path)'. $Error[0]"
}
}

$document = [PdfSharp.Pdf.IO.PdfReader]::Open($file.FullName, [PdfSharp.Pdf.IO.PdfDocumentOpenMode]::Import)
$curentTitle = ""
$i = 1
Foreach($rootb In $document.Outlines)
{
$nonullable = $rootb.Title

if ($nonullable) {
Write-Progress -Id 0 "Delar $curentTitle" -PercentComplete ($i/$document.Outlines.count*100)
$i++;
if ((!(("\" + $rootb.Title + ".pdf") -eq $curentTitle )) -AND (!($curentTitle.toString() -eq "")) )
{
Write-Verbose "---------------------------------------------savepast---------------------------------------------"
$output = Join-Path -Path $DestinationFile -ChildPath $curentTitle
Write-Verbose $output
$currentDoc.save($output);$currentDoc.close
}
if (!(("\" + $rootb.Title + ".pdf") -eq $curentTitle ))
{
Write-Verbose "---------------------------------------------New---------------------------------------------"
$newdocx = New-Object PdfSharp.Pdf.PdfDocument
$newdocx.Version = $document.Version;
$newdocx.Info.Title = $document.Info.Title
$newdocx.Info.Creator = $document.Info.Creator
$currentDoc = $newdocx
}
Write-Verbose "---------------------------------------------addPages---------------------------------------------"
$currentDoc.AddPage($rootb.DestinationPage)

$curentTitle = "\" + $rootb.Title + ".pdf"

}
}
Write-Verbose "---------------------------------------------saveToOutput---------------------------------------------"
$newdocx.save($output);$newdocx.close;Remove-Variable newdocx

0 comments on commit c774a79

Please sign in to comment.