Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

adding PDF options to a script

$
0
0

Hello everyone,

I use a powershell script (provided in the scripting guy blog and slightly modified by myself) to convert all .rtf files in a folder to pdf:

$wdFormatPDF = 17
$word = New-Object -ComObject word.application
$word.visible = $false
$folderpath = "C:\Users\xxx\Desktop\powershelltest\*"
$fileTypes = "*.rtf"
Get-ChildItem -path $folderpath -include $fileTypes |
foreach-object `
{
 $path = ($_.fullname).substring(0,($_.FullName).lastindexOf("."))
 $doc = $word.documents.open($_.fullname)
 $doc.saveas([ref] $path, [ref]$wdFormatPDF)
 $doc.close()
}
$word.Quit()
Exit

My question is this: How do I specify options for the created PDF docs?

I need the created PDFs to have these characteristics:

  • Set the “Initial Page layout” to “Bookmarks Panel and Page”
  • Must be saved as PDF Version 1.4 (acrobat 5.x compatible)
  • Enable fast web view
  • Enable bookmarks to have longer lengths than 40 characters (by default it seems the resultant PDF has 40 character limit on bookmarks, my .rtf files use embedded tc links for bookmarks that are much longer)
  • Not be PDF/A (seems to be default)

Any hints and pointers are much appreciated as I am very inexperienced with powershell and could not find anything helpful in my searches.

Kind regards,
Tiaan


Viewing all articles
Browse latest Browse all 15028

Trending Articles