Closed tekmun closed 4 years ago
Is it just a typo or you put 1 file into InputFile?
$FilePath1 = "$PSScriptRoot\Input\OutputDocument0.pdf"
$FilePath2 = "$PSScriptRoot\Input\OutputDocument1.pdf"
$OutputFile = "$PSScriptRoot\Output\OutputDocument.pdf" # Shouldn't exist / will be overwritten
Merge-PDF -InputFile $FilePath1, $FilePath2 -OutputFile $OutputFile
Hi,
I have written a ps script. On PC, it works flawlessly. On Mac, it doesn't.
param( [Parameter(Mandatory=$true)] [int] $stoppage )
$outputfile = "$PSScriptRoot\40.Day.2020_English.pdf" $inputfiles = '' for ($page = 1; $page -le $stoppage; $page++) { if ($inputfiles -ne '') { $inputfiles += ',' } $inputfiles += "$PSScriptRoot\PDF\$page.pdf" } $command = "Merge-PDF -InputFile $inputfiles -OutputFile $outputfile" Invoke-Expression $command
Can you copy/paste it properly into GitHub. But by the looks of it you're doing some funky stuff with it like using:
Can't you use a normal array without Invoke-Expression? That's asking for trouble. I'm pretty sure -InputFile
thinks you're passing one file and not multiple files the way you do it.
I found the issue. On Mac, the character used to separate directory is "/". On Windows, it is "\". What I have done is to use $IsMacOS function to replace "\" with "/".
Hi, I run this command on the latest Mac OS with the latest Powershell (just installed using brew) Merge-PDF -InputFile .\1.pdf -OutputFile .\output.pdf The command completed successfully but no output.pdf file is generated in local directory.