Welcome Guest Search | Active Topics | Sign In | Register

EO PDF - Setting Blendmode Options
TDahmen
Posted: Monday, July 25, 2016 5:44:08 AM
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
eo_support
Posted: Monday, July 25, 2016 10:49:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
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!
TDahmen
Posted: Wednesday, July 27, 2016 5:26:49 AM
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
eo_support
Posted: Wednesday, July 27, 2016 12:04:05 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

You can only use opacity.

Thanks!
TDahmen
Posted: Thursday, July 28, 2016 8:42:03 AM
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!
eo_support
Posted: Thursday, July 28, 2016 1:33:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.