Convert System.Drawing.Font into Hi Team, I'm trying to Add a text watermark to a PDF document by us

Convert System.Drawing.Font into Hi Team, I'm trying to Add a text watermark to a PDF document by us

Forum member · Oct 27, 2010
Hi Team, I'm trying to Add a text watermark to a PDF document by using a lablefollowing code ceTe.DynamicPDF.PageElements.Label watermarkLable = new ceTe.DynamicPDF.PageElements.Label (text, 0, 250, 500, 100, ceTe.DynamicPDF.Font.Courier, 50, ceTe.DynamicPDF.TextAlign.Center, watermarkFontColor); in here we can set the font type as " ceTe.DynamicPDF.Font.Courier" but i need to set font type as microsoft font ex: Arial, Times New Romen, so is there any way to convert System.Drawing.Font into ceTe.DynamicPDF.Font type Regards, Thilina Kurukulasuriya Associate Engineer-Technology | Team Imprima- Imprima Leap Virtusa (Pvt) Ltd. 752, Dr Danister De Silva Mawatha,Colombo 09 Phone: + +94 11 460 5500 Ext: 5681 | Facsimile: +94 11 470 2199| Mobile: +94 77 254 8204

Re: Convert System.Drawing.Font into Hi Team, I'm trying to Add a text watermark to a PDF document by us

Support · Oct 27, 2010
Hello Thilina, Yes, you can add any TrueType, Type1 fonts to the PDF document using our version 4 DynamicPDF product without any problem. You will have to use the TrueTypeFont class of our API to create a font object by using the required fonts and then you can use this object to set it to the page elements. You will have to make sure that the required font is installed in your C:\WINDOWS\Fonts directory. Below is the code for it. Document doc = new Document(); Page page = new Page(); TrueTypeFont font = new TrueTypeFont("Arial.ttf"); Label label = new Label("Hello cete software ", 100, 400, 400, 100, font, 40, TextAlign.Left, RgbColor.DimGray); label.Angle = -60; page.Elements.Add(label); TransparencyGroup grp = new TransparencyGroup(0.0F); grp.Add(label); doc.Pages.Add(page); doc.Draw(@"Path to save the PDF"); Thanks, ceTe Software Support Team