🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.postscript.programming
Article #1399

Re: Can I convert PDF to PS with VBA

#1399
From: Sampada
Date: Tue, 05 Nov 2002 20:36
26 lines
2173 bytes
You can convert a pdf file to postscript file in VB. Add acrtobat.tlb in project reference.. here is a code 

Set lobjAdobeApp = CreateObject("AcroExch.App") 
Set lobjAdobeDoc = CreateObject("AcroExch.AVDoc") 

szDirPath = "c:\test\" '"C:\testpdf\" 
szFileName = "OutFile.ps" 
szPDFName = "env.PDF" '"TestFile.pdf" 



szTemp = szDirPath & Trim(szPDFName) ' full path to pdf file 
    lobjAdobeDoc.Open szTemp, szFileName 'open the file, with the final filename as the title of the window 
    If (lobjAdobeDoc.IsValid = True) Then ' we opened the document ok 
        Set lobjAdobePDDoc = lobjAdobeDoc.GetPDDoc() 
        nLastPage = lobjAdobePDDoc.GetNumPages() - 1 'Adobe is picky about having the correct page count. 
        lobjAdobeDoc.PrintPages 0, nLastPage, 1, 0, 0 'print the document to the default print driver 
        lobjAdobePDDoc.Close 'shut everything down nicely 
        lobjAdobeDoc.Close 0 
        'FileCopy "c:\RightFax.prn", szDirPath & Trim(szFileName) 'copy the new file to something your app understands 
        'Kill "c:\RightFax.prn" 'clean it out.. not necessary as the next print will overwrite, but I'm paranoid 
        MsgBox "Postscript file created successfully" 
    Else 
        'MsgBox "Could not open " & szPDFName & " in Acrobat" 'something VERY BAD has happened. 
        SendKeys "{ENTER}", True 
    End If
Technical Details
Message-ID: <1de67589.1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de67589.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10c61a,2931266b05a1e0ce
X-Google-Attributes: gid10c61a,public
X-Google-ArrivalTime: 2002-11-05 12:42:04 PST
From: Sampada <smulaye@microgeneral.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.postscript.programming
Subject: Re: Can I convert PDF to PS with VBA
Message-ID: <1de67589.1@WebX.la2eafNXanI>
Date: Tue, 5 Nov 2002 12:36:01 -0800
References: <1de67589.-1@WebX.la2eafNXanI>
Lines: 32
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit