I have two processes, ran in sequence, which use a similar technique to take PDF pages from input file(s) and append them to an output file. My append-page routine accepts a pdftron.PDF.Page and optional horizontal and vertical offset to shift the page in the output stream. I am only shifting the first page of each 19 page merged-in docoument. Basically...
Public Sub AppendPDFPage(ByVal pg As Object, Optional ByVal horizOffset As Single = 0, Optional ByVal vertOffset As Single = 0)
Dim elm As Element
elm = pdfout.mEB.CreateForm(pg, pdfout.mDoc)
Dim Gstate As PDF.GState
Gstate = elm.GetGState
Gstate.SetFillColor(New ColorPt(Color.R / 255.0, Color.G / 255.0, Color.B / 255.0))
If (horizOffset = 0) And (vertOffset = 0) Then
elm.GetGState.SetTransform(1, 0, 0, 1, -horizOffset * 72.0, vertOffset * 72.0)
Dim logoRect As New Rect
elm.GetGState.SetTransform(1, 0, 0, 1, CDbl(Me.HItoPt(horizOffset, 2)), CDbl(Me.VItoPt(vertOffset, 2)) - logoRect.Height)
Works wonderfully on the first iteration... The 2nd generation PDF has that first page shifted exactly as expected (my params are in inches from top left corner).
Second process runs, requesting NO shift, and I loose the shift made by the first process in the 3rd generation.
I do not suspect any pdftron problem, but rather I suspect I need to be looking at something on the input page so that my default page shift is not necessarily zero, or at least is calculated additively.