Gdpicture. Net Tutorial: adding a watermark to a PDF file

Source: Internet
Author: User

Gdpicture. in addition to document display, Twain Scanning Image Acquisition, image processing, and optical character recognition, net can also add watermarks to documents. The following describes how to use gdpicture.. net adds a watermark to a PDF file.CodeExample:

"Download the gdpicture. Net trial version.

Const text as string = "watermark" const textsize as integer = 100 const rotation as single = 320 'note: rotation is anti-clockwise const font as string = "Arial" using gdpicturepdf as new gdpicturepdf. loadfromfile ("C: \ inputexample", false) gdpicturepdf. setmeasurementunit (gradient measurementunit. pdfmeasurementunitpoint) gdpicturepdf. selectpage (1) Using gdpicturepdfback as new gdpicturepdf gdpicturepdfback. newpdf () dim pagewidth as single = gdpicturepdf. getpagewidth () dim pageheight as single = gdpicturepdf. getpageheight () gdpicturepdfback. clonepage (gdpicturepdf, 1) gdpicturepdf. setorigin (pdforigin. pdforigintopleft) gdpicturepdf. clearpagecontent () dim fontresname as string = gdpicturepdf. addtruetypefont (font, true, false, false) gdpicturepdf. settextsize (textsize) gdpicturepdf. drawrotatedtext (fontresname, 0, gdpicturepdf. gettextheight (fontresname, textsize), text, rotation) gdpicturepdf. savegraphicsstate () gdpicturepdf. setblendmode (pdfblendmode. pdfblendmodenormal) gdpicturepdf. setfillalpha (200) dim status as gdpicturestatus = gdpicturepdf. drawpage (gdpicturepdfback, 1, 0, pageheight, pagewidth, pageheight) gdpicturepdf. resetgraphicsstate () gdpicturepdf. savetofile ("C: \ output.pdf") End using end using

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.