two stamps overwriting themselves

two stamps overwriting themselves

Forum member · Aug 31, 2010
i convert a document to pdfstream. I create a merge document. I create headers and footers. i create a section and start it. i stamp the section with the template. i go to convert several other documents. i convert to pdfstream I crearte new header and footer as blanks ' ' i create s new section and start it i stamp new section with template. second document on, shows both stamps. how can i remove a stamp after the first document is created. Here's my code. pdfByteStream = Converter.Convert("http://gpweb.sandia.gov/usq/usqscreenpdf.aspx?usqid=" & usqid & "&ts=" & timestamp) Dim pdf As New PdfDocument(pdfByteStream) Dim document As New MergeDocument(pdf) Dim template As New ceTe.DynamicPDF.Template() Dim header As New ceTe.DynamicPDF.PageElements.Label("2001-USC(5-2009) Supersedes(5-2007) Issue ", 60, 20, 400, 20, Font.TimesRoman, 10, TextAlign.Left, RgbColor.Black) Dim footer As New ceTe.DynamicPDF.PageElements.PageNumberingLabel("%%CP%%", 300, 740, 100, 20) template.Elements.Add(header) template.Elements.Add(footer) document.StampTemplate = template attachmentds = usqhelper.GetAttachments(usqid) i = 1 Dim template2 As New ceTe.DynamicPDF.Template() Dim header2 As New ceTe.DynamicPDF.PageElements.Label(" ", 60, 20, 400, 20, Font.TimesRoman, 10, System.Web.UI.WebControls.TextAlign.Left, RgbColor.Black) Dim footer2 As New ceTe.DynamicPDF.PageElements.PageNumberingLabel(" ", 300, 740, 100, 20) Dim pdfbytestreama As Byte() If attachmentds.Tables(0).Rows.Count > 0 Then For Each row In attachmentds.Tables(0).Rows ReDim Preserve filestring(i) filename = row("filename").ToString() filestring(i) = "\\ws14snlnt\USQ\records\" & filename filename = Left(filename, InStr(filename, ".") - 1) tempfile = "\\ws14snlnt\usq\tmp\" & filename & ".pdf" pdfByteStreama = Converter.Convert(filestring(i)) Dim apdf As New PdfDocument(pdfbytestreama) If i = 1 Then template2.Elements.Add(header2) template2.Elements.Add(footer2) Dim section2 As Section section2 = document.Sections.Begin() section2.StampTemplate = template2 End If document.Append(apdf) i = i + 1 Next End If document.Draw("\\ws14snlnt\usq\usqrecord\" & usqnumber & ".pdf")

Re: two stamps overwriting themselves

Support · Sep 3, 2010
Hello, In the code you are setting the stamp template for the whole document initially. template.Elements.Add(header) template.Elements.Add(footer) document.StampTemplate = template This template will be displayed on all the pages of the document. Then again you are adding template to some specific sections. section2 = document.Sections.Begin() section2.StampTemplate = template2 Here both the templates will be over lapped as one template is from section and one from the document. When adding templates you will have to make sure that for which pages you will need the template. Thanks, ceTe Software Support Team.