Hello,
I am using your PDF Stamp SDK but have a new situation I need to fix. I am
currently using the following code to stamp a page number and image on all
pages:
lngPDFID = VeryStampOpen(strCurrPDF, App.Path & strJobsDir & strWO &
"\Temp\" & strWO & " Numbered File.pdf")
lngPDFRetCode = VeryStampAddText(lngPDFID, 5, "\p", 0, 16, -36, -15, 0, 0,
0, 0, "Arial", 6, 0, "", 0)
lngPDFRetCode = VeryStampAddImage(lngPDFID, 1, App.Path &
"\PMG_Letterhead.jpg.", 0, 0, 0, 1, 10, 10, 0, 0, 0)
No I need to perform this operation on odd numbered pages only. 1, 3, 5, 7,
etc. How can I do that?
Thanks,
Customer
-------------------------------
You can use following sample C++ source code to get pagecount from PDF file first, and add the stamps to any page that you want, you can also port this C++ source code to any program language that you want,
id=VeryStampOpen(szPDFFile,"_001.pdf");
if(id>0)
{
int page = 1;
int pagecount = VeryStampGetFunction(id, Very_Get_PdfPageCount, 0, 0, 0, 0);
VeryStampSetFunction(id, Very_Set_Opacity, 50, 0, 0, 0);
for(page = 1; page <= pagecount; page+=2)
{
char m_szStampBuf[1024];
int left = VeryStampGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "left", 0);
int top = VeryStampGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "top", 0);
int pagewidth = VeryStampGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "width", 0);
int pageheight = VeryStampGetFunction(id, Very_Get_PageBoxForStamp, page, 0, "height", 0);
VeryStampSetFunction(id, Very_Set_Range, page, 1, 0, 0);
sprintf(m_szStampBuf,"Page:<%d>, Page Box: [%d %d %d %d]",pagecount-page+1,left,top,pagewidth,pageheight);
VeryStampAddText(id, 2, m_szStampBuf,255,0,0,0,0,0,0,300,0,10,1,"https://www.verypdf.com", 0);
VeryStampSetFunction(id,Very_Set_Text_Leading,20,0,0,0);
strcpy(m_szStampBuf,"2200444\n20555\n2200666\n2777");
VeryStampAddText(id, 1, m_szStampBuf, 255,18,0,0,0,0,0,200,0,10,1,NULL,0);
}
VeryStampClose(id);
}
VeryPDF