i’m try to add watermark to existing document and save to doc, it fine but when i save to pdf is not show vowel
I use this code C#
public Shape Watermark(Document doc) {
string text = @"สำเนา";
Shape watermark = new Shape(doc, ShapeType.TextPlainText);
watermark.TextPath.Text = text;
watermark.TextPath.Bold = false;
watermark.Stroked = false;
watermark.FillColor = Color.Black;
watermark.Fill.Color = Color.Black;
watermark.WrapType = WrapType.None;
watermark.Fill.Opacity = 0.3;
watermark.AlternativeText =text;
watermark.TextPath.FontFamily = "TH Sarabun New";
watermark.Width = 500;
watermark.Height = 100;
watermark.Rotation = -40;
watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
watermark.VerticalAlignment = VerticalAlignment.Center;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
return watermark;
}
public void AddWatermark(Shape watermark) {
InsertWatermark insert = new InsertWatermark();
Paragraph paragraph = new Paragraph(doc);
paragraph.AppendChild(watermark);
foreach (Section sect in doc.Sections)
{
insert.InsertWatermarkIntoHeader(paragraph, sect, HeaderFooterType.HeaderPrimary);
insert.InsertWatermarkIntoHeader(paragraph, sect, HeaderFooterType.HeaderFirst);
insert.InsertWatermarkIntoHeader(paragraph, sect, HeaderFooterType.HeaderEven);
}
}
public void SaveToFile(string pathOutputFile)
{
doc.Save(pathOutputFile);
}
when isave to .pdf
Capture.PNG (34.7 KB)
When i save to .doc
Capture1.PNG (18.0 KB)