Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PDF through VBA: How to set Initial View?

273 views
Skip to first unread message

Jon_...@adobeforums.com

unread,
Feb 26, 2009, 1:22:22 PM2/26/09
to
- Adobe Acrobat 6.0
- MS Office 2003
- MS Windows XP Professional SP2

Like legions of people in Google, 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.
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

John_T...@adobeforums.com

unread,
Feb 26, 2009, 3:13:22 PM2/26/09
to

Jon_...@adobeforums.com

unread,
Feb 27, 2009, 7:27:38 AM2/27/09
to
Oops. Sorry. Thanks for the info. I'll try there.
0 new messages