I am trying to automate the creation of PDFs from MS Word. I have succeeded. My VBA code works fine (have pasted it below). I can create a PDF, and give it a title and author.
The problem I am having is with the Initial View settings, i.e. how the document opens. I want to hardcode:
1. Show to "Page Only"
2. Page Layout to "Continuous"
3. Magnification to "Fit Width"
The first I have done, using AcroExch.PDDoc's SetPageMode() function (although it seems to default to that even without doing this). I cannot, for the life of me, find any reference to the second and third, though. This must be doable, right? Be kind of weird not to have access to this in the API.
Hours of Googling has thrown up three ideas I've discarded.
1. AcroExch.App's SetPreference() function. This would presumably change preferences on the machine making the PDF, not reading it. I don't want to fiddle with other people's preferences anyway.
2. AcroExch.AVPageView's ZoomTo() function. Ditto. I am not creating an app to view PDFs, just trying to configure the default for opening one I've created.
3. An "undocumented" SetOpenInfo() in AcroExch.PDDoc. This looked the most promising for Magnification, but nobody seems to be able to get it to work, and it does nothing for me either. Someone somewhere even suggested it had been deprecated in later versions of Acrobat.
So... what do I do?
Thanks in advance for any pointers.
jON
===============================================
Sub MakePDF(strFilename As String, strTitle As String, strAuthor As String)
Dim pdfD As PdfDistiller
Dim strPDFName As String
Dim strPSName As String
strPSName = strFilename & ".ps"
strPDFName = strFilename & ".pdf"
'... make PS
Application.ActivePrinter = myPDFPrinter
Application.PrintOut Filename:="", _
Range:=wdPrintAllDocument, _
Item:=wdPrintDocumentContent, _
Copies:=1, _
Pages:="", _
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, _
Collate:=True, _
Background:=False, _
PrintToFile:=True, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0, _
OutputFileName:=strPSName, _
Append:=False
'... make PDF
Set pdfD = New PdfDistiller
pdfD.FileToPDF strPSName, strPDFName, ""
'... tag PDF
Set qq = CreateObject("AcroExch.PDDoc")
b = qq.Open(strPDFName)
b = qq.SetInfo("Title", strProperties_Title)
b = qq.SetInfo("Author", strProperties_Author)
b = qq.SetPageMode(1) '... 1 = PDUseNone
b = qq.Save(33, strPDFName) '... 33 = PDSaveFull (1) OR PDSaveCollectGarbage (32)
b = qq.Close
End Sub
2. Page Layout to "Single Page"
3. Magnification to "Fit Width"
My software configuration is as follows:
- Adobe Acrobat 7.9
- Microsoft Windows XP SP2
- Visual Basic 6
Has anyone worked with this attributes of Acrobat?