Hi,
Thanks for your response. I have converted the code into c# mentioned in the following link.
http://www.quickpdf.org/forum/watermark_topic230.html" rel="nofollow - http://www.quickpdf.org/forum/watermark_topic230.html
******************************************************************************* string printFile = fileName; int transp = 10; //The transparency as a percent value int drewin = 35; //Angle of rotation... try with values over and below zero... not more than -45 to 45 string ausr; if (_objPdfLibrary.Unlocked() == 1) { try { string waterMarkText = "Uncontrolled Copy";
if (waterMarkText.Trim().Length > 40) //The text should have max. 40 characters waterMarkText = waterMarkText.Substring(1, 40);
_objPdfLibrary.LoadFromFile(fileName, ""); _objPdfLibrary.SetOrigin(1); _objPdfLibrary.SetMeasurementUnits(0); //means pixel for(int i = 1 ; i<= _objPdfLibrary.PageCount();i++) { int ts, tl, th; ts = tl = 0; _objPdfLibrary.SelectPage(i); int sc1 = i / 2; int sc2 = i * 2; if (_objPdfLibrary.PageWidth() < 250) ts = 8; if ((_objPdfLibrary.PageWidth() > 249) && (_objPdfLibrary.PageWidth() < 400)) ts = 12; if ((_objPdfLibrary.PageWidth() > 399) && (_objPdfLibrary.PageWidth() < 650) ) ts = 18; if ((_objPdfLibrary.PageWidth() > 649) && (_objPdfLibrary.PageWidth() < 1500)) ts = 22; if ((_objPdfLibrary.PageWidth() > 1499) && (_objPdfLibrary.PageWidth() < 2500)) ts = 30; if(_objPdfLibrary.PageWidth() > 2499) ts = 38;
_objPdfLibrary.SetTextSize(ts);
int tw = tl * ts; //Textwidth is the sum from length * size... tw = tw / 2; tw = tw + drewin; th = (tw * drewin) / 45;
_objPdfLibrary.SetTransparency(transp); if (ausr == 'lo') _objPdfLibrary.DrawRotatedText(ts, th, drewin, waterMarkText); // left - top - width - height if (ausr == 'lu') _objPdfLibrary.DrawRotatedText(ts, _objPdfLibrary.PageHeight() - th, drewin, waterMarkText); // left - top - width - height if (ausr == 'ro') _objPdfLibrary.DrawRotatedText(_objPdfLibrary.PageWidth() - tw, ts, drewin, waterMarkText); // left - top - width - height if (ausr == 'ru') _objPdfLibrary.DrawRotatedText(_objPdfLibrary.PageWidth() - tw, _objPdfLibrary.PageHeight() - tl, drewin, waterMarkText); // left - top - width - height
_objPdfLibrary.CompressContent(); }
_objPdfLibrary.SaveToFile(fileName); } catch (Exception ex) { } } **************************************************************************
But unable to convert the following code. I can't understand.
if cbausr.Text = 'Links oben' then ausr := 'lo'; //top left if cbausr.Text = 'Links unten' then ausr := 'lu'; //bottom left if cbausr.Text = 'Rechts oben' then ausr := 'ro'; //top right if cbausr.Text = 'Rechts unten' then ausr := 'ru'; //bottom right
Could you explain the above?
Thanks and Regards Santhanaraman.S
|