I have a project that is using FTC to generate documents and as a new requirement I have to add some data in the footer of each page starting page 2 and as well add page numbers where page 1 is page no 3 and then to increment them and put them on the page.
Any idea if this can be implemented and what is the best way to do that ?
I searched little bit on the FTC manual but I did not find anywhere mentioning how to do that .
this can be simple done with the PostPageDraw-Event. Add the following code to it:
#If Not DebugBuild
#pragma DisableBoundsChecking
#pragma NilObjectChecking False
#pragma StackOverflowChecking False
#Endif
' Are we in a non-page view mode?
If Not Me.isPageViewMode Then Return
' Are we printing?
If printing Then
' Get the scale.
scale = printScale
Else
' Get the scale.
scale = Me.getDisplayScale
End If
Dim doc As FTDocument
' Get the document.
doc = Me.getDoc
Dim left, top, scale As double
' Compute the bottom left corner coordinates.
left = doc.getLeftMargin + doc.getMarginWidth
top = doc.getTopMargin + doc.getMarginHeight
' Set up the graphic port
g.Bold = False
g.ForeColor = &c000000
g.Italic = False
g.TextFont = "Arial"
g.TextSize = 12 * scale
g.Underline = False
' Draw the page number.
g.DrawString("Page " + Str(p.getAbsolutePage + 1), _
FTUtilities.getScaledLength(left - 0.75, scale), _
FTUtilities.getScaledLength(top + 0.15, scale))[/code]
I hope this helps you.[/quote]
Hi Martin,
the way I create the pages are via the code so I have nothing related to postage draw.
While I tinkered little bit there I found that if I do
[code]cw.Target.callPostPageDraw[/code] where the code is the following
[code]cw = new FTCConverterWindow
cw.footer = footerText
cw.pageIdx = 1
state = cw.target.setInhibitUpdates(true)
cw.target.setPageSize(8.27, 11.69)
cw.target.setMargins(0.5, 0.5, 1.2, 0.5)
cw.target.setPrintMarginOffsets(0.5, 0.5, 1.2, 0.5)
doc = cw.target.getDoc
cw.target.setPageViewMode
--------
//all the loops to fetch the data and draw it
--------
state = cw.target.setInhibitUpdates(False)
cw.Target.callPostPageDraw
cw.target.updateFull
contentSet.Close()
doc.print(g, app.printer, 0, doc.getNumberOfPages - 1)
cw.close
Can you please clear for me to what are you referring when calling [quote] ’ Get the scale.
scale = Me.getDisplayScale[/quote] and [quote] p.getAbsolutePage + 1[/quote]
As I mentioned, in the code I draw one page as the global info, one page is left blank and I have to start counting 1 from the 3rd page, can I do that ?