Print Page | Close Window

Bates Stamping Question

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3757
Printed Date: 25 Apr 24 at 11:29PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Bates Stamping Question
Posted By: Ken_SF
Subject: Bates Stamping Question
Date Posted: 01 Nov 19 at 3:08PM
Hi,

Does anyone know if there is an 'official' way to bates stamp (serialize individual pdf pages with a numeric (and possibly a prefix or suffix))?

I am trying to bates stamp some already-existing PDF documents with multiple pages.

I was able to do this using the DrawText function in Quick PDF Library (function written for powerbasic is shown below).

The problem I am having is that my program doesn't erase bates stamping on pages created by third party programs.  My experience is, from using a few third party bates stamping programs, is that stamping with one program erases the bates stamp added with another, so they all seem to be adding serialized page numbers using the same technique and that appears to be something different than using drawtext.

Here is the function I am using, in case someone needs to add something that looks like bates stamping.  I did have to fiddle a bit with the location (note where I had to add 150 to the page height) to get the text to draw in the lower right hand corner of the page. It would be good to understand why that extra + 150 was needed.

Thanks in advance.

Ken

FUNCTION AddPageNumberPDF() AS LONG
'http://www.quickpdf.org/forum/add-page-numbers-to-existing-pdf_topic2096.htm
LOCAL myid AS LONG, i AS LONG
LOCAL ph,pw AS DOUBLE

dplLoadFromFile( gLibInstance1&,"sample1_bates.pdf","")
myid = dplAddStandardFont( glibinstance1&,4)

FOR i = 1 TO dplpagecount(gLibInstance1&)

'https://www.debenu.com/docs/pdf_library_reference/SelectedPage.php
  dplSelectPage( gLibInstance1&,i)

'https://www.debenu.com/docs/pdf_library_reference/NormalizePage.php
  dplNormalizePage( gLibInstance1&,0)

'https://www.debenu.com/docs/pdf_library_reference/SetOrigin.php
  dplSetOrigin(gLibInstance1&,1)  'Specifies which page corner to use for the origin: 0 = Bottom left (default), 1 = Top left, 2 = Top right, 3 = Bottom right, Anything else = Bottom left

'https://www.debenu.com/docs/pdf_library_reference/Fonts.php
'https://www.debenu.com/docs/pdf_library_reference/Text.php

'DPLFontType(int InstanceID)  'https://www.debenu.com/docs/pdf_library_reference/FontType.php

'selectfont: Select one of the fonts which have been added to the selected document. The FontID must be a valid ID as returned by one of the Add*Font functions or returned by GetFontID .

 dplSelectFont(gLibInstance1&,myid)

'https://www.debenu.com/docs/pdf_library_reference/SetTextSize.php
 dplSetTextSize(gLibInstance1&,12) 'Set the size of the text to use for any subsequently drawn text. The text size is always measured in points, even if the measurement units have been changed with SetMeasurementUnits.
 dplSetTextColor(gLibInstance1&,1,0,0)   'sets text color to red.   NOTE : Each color component has a range of 0.0 to 1.0   and not 0 to 255 like many other libraries.

 ph = dplPageWidth(gLibInstance1&)
 pw = dplPageHeight(gLibInstance1&)

'for some reason I had to use 70% of pw to get correct width and + 150 to get correct vertical location on bottom of page (else was too high or too far to right to be visible)
  dplDrawText( gLibInstance1&,pw *.70 ,ph + 150,"pg1 " & FORMAT$(i)) 'pw - 30, ph - 20, "Page" +  format$(i))
NEXT i

dplSaveToFile( gLibInstance1&,"newfile.pdf")
END FUNCTION






Replies:
Posted By: Ingo
Date Posted: 01 Nov 19 at 3:22PM
Hi Ken,

additionally to NormalizePage you can use CombineContentStream in cases if you don't see your numbers.
What i couldn't find is the SetMeasurementUnits (this could fix your issue?):
https://www.debenu.com/docs/pdf_library_reference/SetMeasurementUnits.php

Cheers and welcome here,
Ingo


-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk