Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print to PDF printer via macro

Status
Not open for further replies.

jvaneert

MIS
Sep 10, 2002
18
0
0
NL
Hello,
I am using a macro that saves a powerplay report as .pdf file per layer. So i use 20 layers and this results in 20 pdf files.
Since "fit to page" is no option when exporting to .pdf i thought of using a "pdf printer", via this way i can use the "fit to page" option.
But how do i add this printer in my macro? and how should the macro be changed that prints the files instead of saving them via Powerplay?

The macro looks like this

ption Explicit

Sub Main()
Dim objPDF as Object
Dim objPPRep as Object
Dim i as Integer
Dim RepNam as String

Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.Open( "X:\Kobe Oberhausen\Commerciele rapportage\2004\200411\E-mail bestanden\Inkcomb pro vertreter\Inkcomb pro vertreter.ppr" )
objPPRep.visible( TRUE )
i=1

For i=1 to objPPRep.Layers.Count
RepNam = objPPRep.Layers.Item(i).Name
Set objPDF = objPPRep.PDFFile( "X:\Kobe Oberhausen\Commerciele rapportage\2004\200411\E-mail bestanden\Inkcomb pro vertreter\ " & RepNam , True )
With objPDF
.SaveEntireReport = False
.SaveAllCharts = False
.AxisOnAllPages = True
.ChartTitleOnAllPages = False
.IncludeLegend = True
.SetListOfLayersToSave objPPRep.Layers.Subset(i,i)
.SetListOfRowsToSave objPPRep.Rows
End With
objPDF.Save
Next i

Set objPPRep = Nothing
Set objPDF = Nothing
End Sub

Can someone help me?
 
Maybe this will help:

Dim objRepPrt as Object
Dim objPPlayApp as Object
.
.
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.Open( "X:\Kobe Oberhausen\Commerciele rapportage\2004\200411\E-mail bestanden\Inkcomb pro vertreter\Inkcomb pro vertreter.ppr" )
objPPRep.visible( TRUE )
i=1

objPPlayApp.FileSetPrinter YOURPDFPRINTER

For i=1 to objPPRep.Layers.Count
Set objRepPrt = objPPRep.Print
objRepPrt.SetListOfLayersToPrint objPPRep.Layers.Subset(i,i)
objRepPrt.FitToPage = True
objRepPrt.PrintOut
Next i


Set objPPlayApp = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top