|
Rank: Newbie Groups: Member
Joined: 7/25/2016 Posts: 3
|
Hello,
I want to add text over an existing "random" pdf. Random because i don't know what kind of PDF will be inserted. To not loose information by overlapping existing content i would like to use the belndmode "difference" with white text. Is there any way to set the blendmode for text with eo.pdf for .NET?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, You can do that with HTML to PDF with opacity. For example, the following code load source.pdf, add some half-transparent text to the first page and then save the result:
Code: C#
PdfDocument doc = new PdfDocument("c:/1.pdf");
HtmlToPdf.ConvertHtml("<div style='opacity:0.2;font-size:80px;'>Transparent Watermark</div>", doc.Pages[0]);
doc.Save("c:/2.pdf");
Note that: 1.CSS attribute opacity is used to specify the opacity of the output text; 2. The second argument of ConvertHtml is a PdfPage object. This specifies which page it should output to. If you pass "doc" directly, it will create a new page instead of output to an existing page; Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/25/2016 Posts: 3
|
Thank you for the reply, I was thinking about opacity, but i don't know wheather the pdf has a light background or not, so black text with opacity may not be visible. I want the following effect, so you are able to read both text if it happens to overlap. Also by applying the same effect twice the text will be inverted again, so the text will be visibly gone. If it's not possible i have to stick with opacity. Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
You can only use opacity.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/25/2016 Posts: 3
|
Hello,
the ConvertHtml method takes about 3 seconds so sadly it is not acceptable. Is there no way to set the Opacity for PdfTextContent or AcmText?
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
PdfTextContent does not support blending mode. The HTML to PDF is the only one supports it. However the converter should run much faster on subsequent conversions than the first time. The first time you call the HTML to PDF converter it must initialize a lot of internal data thus takes much longer. If you call it again it will be much faster.
Thanks!
|
|