废话不多说,直接上代码
void MyWatermark(const char* pszInFilename, const char* pszOutFilename)
{
PdfMemDocument doc( pszInFilename );
PdfPainter painter;
PdfPage* pPage;
PdfRect rect;
int i;
//PdfShadingPattern pattern;
int iTotalPages = doc.GetPageCount();
printf("total pages:%d\n",iTotalPages);
for(i=0;i<iTotalPages;i++)
{
pPage = doc.GetPage( i );
if( !pPage )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
}
painter.SetPage(pPage);
PdfFont* pFont;
pFont = doc.CreateFont( "Arial" );
pFont->SetFontSize(20);
painter.SetFont(pFont);
//pPage->GetContents()->ToString();
PdfExtGState trans( &doc );
trans.SetFillOpacity( 0.5 );
trans.SetStrokeOpacity(0.5);
painter.SetExtGState( &trans );
painter.SetColor(1,0,1);
#if 1