Welcome Guest Search | Active Topics | Sign In | Register

Align watermark text to center or right? Options
Sfd
Posted: Friday, September 8, 2017 11:33:31 AM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Dear,

We are evaluating your product EO.PDF (we are currently using concurrent products) and we are looking a way to add watermark to existing PDF, we look your sample and see that we need to use the 'BeforeRenderPage', a TextLayer, a TextContent and that's it, easy till now.
We want to align the text watermark to center or right of the pdf, what is your recommandation to do this?

Note: By the way the textContent doesn't support line return, is it normal or is there a tip?

Regards
JC
eo_support
Posted: Friday, September 8, 2017 11:43:43 AM
Rank: Administration
Groups: Administration

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

You will NOT be able to add watermark to existing PDF file. You can only add additional output to an existing PDF file. The different is a watermark is below the existing content, and any additional output is on top of existing content. You can think a PDF page as a canvas that you can paint on. If the canvas already have a tree on it, it is NOT possible for you to paint something below that tree. You can only paint something on top of it.

If you are creating a new PDF file, then you can add watermark before your main output is generated. For example, if you use our HTML to PDF converter to generate the main output, then you can use BeforeRenderPage event because that event is called before the main output is created on the page. The key for "watermark" is that it is created before the main contents is created on the page. The fact that you would use BeforeRenderPage event is because this event is called before the main output is created.

Beside the fact that a watermark must be created before the main contents is created, it is the same as any other content. That means you can use whatever method that you like to create the watermark. For example, you can use the HTML to PDF converter to create the water mark as well. In fact if you use the HTML to PDF converter, you can use CSS to align the text easily.

Hope this helps. Please feel free to let us know if you have any questions.

Thanks!
Sfd
Posted: Friday, September 8, 2017 11:55:39 AM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Sorry i did a mistake we use the Watermark term but it is not the case, you call this 'rubish', we want to add text after render...
eo_support
Posted: Friday, September 8, 2017 12:01:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
To add contents into an existing PDF file is very easy. You can do something like this:

Code: C#
//Load the existing PDF file
PdfDocument doc = new PdfDocument(your_pdf_file_name);

//Start the new output from the first page. Change this if you
//want to start on another page
HtmlToPdf.Options.StartPageIndex = 0;

//Render HTML to that page
HtmlToPdf.ConvertHtml(some_html_to_add, doc);

//Save the result
doc.Save(result_pdf_file);


This is just one way to do it but is probably the easiest way. Let us know if you still have any questions.

Thanks!
Sfd
Posted: Monday, September 11, 2017 4:38:28 AM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Thank you very much for your help, anyway to add RubberStamp on existing PDF we think to use ACM with OnAfterRenderPage, we use an AcmBlock with AcmText inside and use alignment.
Last question, using the AcmText how we can have/simulate a multiline text (new line (\r\n))?

Regards
eo_support
Posted: Monday, September 11, 2017 11:58:46 AM
Rank: Administration
Groups: Administration

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

You would use AcmParagrah instead for that case.

Thanks!
Sfd
Posted: Monday, September 11, 2017 12:05:54 PM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Thank you for fast reply, great support.
Last question we can't find any text opacity/transparency, is it something you plan to add? (great for Stamp)

Regards
eo_support
Posted: Monday, September 11, 2017 12:14:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Have you tried setting the text color with a RGBA color with an alpha channel?
Sfd
Posted: Monday, September 11, 2017 12:18:18 PM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Yes i tried with alpha channel but it didn't work.
Sfd
Posted: Tuesday, September 12, 2017 3:11:35 AM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Could you confirm it is working or not the color alpha channel because we can't make it work! It is important for us to have this working before to purchase.
eo_support
Posted: Tuesday, September 12, 2017 1:12:00 PM
Rank: Administration
Groups: Administration

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

We have looked into this. The ACM interface does not support transparency. However the HTML to PDF interface does support transparency. Here is a small piece of code demonstrates how it works:

Code: C#
//Load your existing PDF file
PdfDocument doc = new PdfDocument(your_existing_pdf_file);

//Convert some text with 50% opacify
HtmlToPdf.ConvertHtml("<div style='opacity: 0.5;color:red;'>ABCDE</div>", doc.Pages[0]);


Here the key is the CSS style attribute "opacity:0.5". The second argument specifies on which page you would like to stamp to be generated. You can also modify the HTML to adjust the output position of the stamp.

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!

Sfd
Posted: Tuesday, September 12, 2017 1:16:41 PM
Rank: Newbie
Groups: Member

Joined: 9/8/2017
Posts: 7
Thank you for your support.
eo_support
Posted: Tuesday, September 12, 2017 1:50:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
No problem. Please feel free to let us know if there is anything else.


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.