TextControl Images/Watermarks - watermark

In version 18 of TextControl (http://www.textcontrol.com) there is supposed to be the ability to add background images/watermarks to the document, however I find that the behavior of the various overloads, etc is not working correctly and that the documentation is rather scarce on examples. Does any one have a working example of adding watermarks to a Word document through the ServerTextControl object?
This functionality didn't exist in previous versions, so I recognize it's still rather new, I just find it weird that doing something like
tx.Images.Add(draftImage, pageNumber, location, ImageInsertionMode.BelowTheText);
doesn't actually add the images to the document, but if I use another overload beforehand, it adds both?
I just need a loop along the lines of
foreach (TXTextControl.Page page in pages){
page.Select();
var location = tx.InputPosition.Location;
var pageNumber = page.Number;
tx.Images.Add(draftImage, pageNumber, location, ImageInsertionMode.BelowTheText);
}
where location is supposed to be the beginning of the page.
Any help would be appreciated, this should be simple!
Thank you

Finally got a response to this on their forum, it's not a complete solution, but it works for the most part. Figured I would follow up here, so that anyone who ends up on this page would get the help I wanted.
http://forums.textcontrol.com/showthread.php?325522-Watermarking-Background-Image-on-Saved-Documents-in-X8&p=41815#post41815

Related

PageNumber in Scripts for ActiveReports 7

I'm not very used to Active Reports and I got an old software using those. The software provide some kind of stripped version of Active Reports Designer 7.
I got a PageFooter section with some fields and I want to remove one to display it only when it's the last page.
Basically, what I want to do is this in scripts :
if (this.PageNumber == this.PageCount) {
Field.Visible = true;
}
I only find one post here that say this.PageNumber should work, but it dosent.
So I tried to use the ReportInfo using the FormatString as {PageNumber}, but I don't seems to be able to read the value using this.ReportInfo.Value or this.ReportInfo.Text
I also tried to make a TextBox, using SummaryType : PageCount. But I'm still unable to read the Value.
So the question is :
How can I know the Page Number and Page Count in the script section?
Or how can I read the value of those textbox I created ?
Thanks a lot!
I think these docs cover what you are looking for:
https://help.grapecity.com/activereports/webhelp/Legacy/AR7Help/OnlineEN/AddPageNumbering.html
https://help.grapecity.com/activereports/webhelp/Legacy/AR7Help/OnlineEN/index.html

videojs-thumbnails plugin shows thumbnails at incorrect time

I'm trying to use "videojs-thumbnails" plugin from https://github.com/brightcove/videojs-thumbnails and noticed that thumbnail's time, specified in the plugin configuration is not matching the timestamp in the seek bar. Coming across different comments regarding this issue I found suggestion at https://github.com/brightcove/videojs-thumbnails/issues/43 to replace line
mouseTime = Math.floor((left - progressControl.el().offsetLeft) / progressControl.width() * duration);
to
mouseTime = Math.floor((left) / progressControl.width() * duration);
By removing
- progressControl.el().offsetLeft
However, that produces still not exact time match.
Finally I came with redefined value for the
var left
Getting it from the current value of
.vjs-mouse-display
So, my final codes are:
left=parseInt((document.querySelector('.vjs-mouse-display').style.left),10);
mouseTime = Math.floor((left) / progressControl.width() * duration);
Now everything works correctly.
Greatly appreciate for comments/suggestions.
This is NOT an answer to your specific question / issue, but rather, an alternative implentation approach.
I, too, wanted thumbnails for my video(s), so I proto-typed a page
that used videoJS's plugin. I don't recall all the details of the
issues that I ran into trying to use that plugin, but I finally decided
to abandon the plugin, and design an alternative, which has its own
separate 'slider' just above the viewer. [ One 'drags' my slider,
(rather than hover along it, as you do on YouTube's videos), so that it
can work straight-forwardly on touch-screens...i.e. on Android, etc. ]
And, rather than try to extract images from the video in real-time,
(See: How to generate video preview thumbnails for use in VideoJS? ), I chose to prepare the images, ahead of time, using 'ffmpeg' and the cmd-line interface to 'ImageMagick'.
Details of that part are here:
http://weasel.firmfriends.us/GeeksHomePages/subj-video-and-audio.html#implementing-video-thumbnails
My 'proof-of-concept' webpage based on that approach is here:
https://weasel.firmfriends.us/Private3-BB/
I hope this is helpful.

Copy language content to another

I'm on IP 4.0.11.
Is it possible to copy all content of a language to another (ie to edit only texts and not style or html)? Is there an option or perhaps in database?
Thanks in advance.
At this time you can only copy pages. In your case I'd do like this:
Create a new language.
Create same menus in new language (same name and alias).
Then go to an original language.
Select page (copying parent copies children, too)
Click "copy" icon.
Go to a new language.
Select required menu.
Click "paste" icon.
Repeat 3-8.
It's a bit of manual work, but it's a fool-proof. It shouldn't take you very long. Changing a database may create many errors.
Thanks for answer, Audrius. This works fine with one caveat: The pages pasted into the new language still gets prepended with the old language's language prefix.
Example: copied english page "home" to Norwegian and set the url to "hjem". The new page now got the url /en/hjem instead of no/hjem as expected.
I'm on 4.0.16. Thankful for any hints.
Update May 21st:
Did some debugging. Apparently there is nothing in the code of Ip\Internal\Pages copySinglePage() that cares about changing the $copy['languageCode'] for the new page to be inserted.
Line 93 and onwards (referring to 4.0.16):
unset($copy['id']);
$copy['parentId'] = $newParentId;
$copy['pageOrder'] = $newIndex;
$copy['urlPath'] = UrlAllocator::allocatePath($copy['languageCode'], $copy['urlPath']);
whereas I'd also expect some logic setting
$copy['languageCode'] = something;
Hope this reaches the developers

iTextSharp 5.3.3: replace the pages from the 1st document and insert the pages from the 2nd document instead of them

Forgive me for the bad english.
I want replace the pages from the 1st document and insert the pages from the 2nd document instead of them. I use itextsharp 5.3.3. Pages of the Second document contain pictures.
My code:
reader1:=New iTextSharp.text.pdf.PdfReader (file_name_1);
reader2:=New iTextSharp.text.pdf.PdfReader (file_name_2);
Document:= New iTextSharp.text.Document();
Document.Compress:=False;
For i:=4 To reader1.NumberOfPages Do
reader1.SetPageContent(i,reader2.GetPageContent(i));
End For;
Stamper:=New iTextSharp.text.pdf.PdfStamper(reader1, New System.IO.FileStream(new_file_name, System.IO.FileMode.CreateNew));
stamper.Close();
As a result, the images in new document mixed up.
What am I doing wrong?
Thanks for any help!
Your code is wrong on many levels. You are copying content streams without copying any of the resources. I never want to see such code again, ever!
Please read http://www.manning.com/lowagie2/samplechapter6.pdf
The best way to achieve your assignment is to use PdfCopy. Create two PdfReader objects, and add 4 PdfImportedPage objects from the second reader, following by PdfImportedPage objects from the first reader starting at page 5.
Use the following code samples for inspiration:
http://itextpdf.com/examples/iia.php?id=123
http://kuujinbo.info/iTextInAction2Ed/index.aspx?ch=Chapter06&ex=Concatenate
If you've found a page advising to use your original approach, please let me know so that I can take action to have that page removed. If you've found this page on itextpdf.com, please DO NOT USE those examples WITHOUT READING THE DOCUMENTATION!

Get Page URL using Sitefinity 4 Fluent API

Okay, this seems like a pretty simple thing to do. But I'm trying to use the Sitefinity 4 Fluent API to query for a page and populate the Text/NavigationUrl properties of a HyperLink. The text gets populated fine - but it has a hard time getting the Url from the page.
PageNode page = App.WorkWith().Page(PageId).Get();
PageLink.Text = page.Title;
PageLink.NavigateUrl = page.Urls.Where<PageUrlData>(pU => pU.RedirectToDefault == false).FirstOrDefault<PageUrlData>().Url;
The first and second line work fine (PageLink.Text shows the page title). On the third line, I get an "Object reference not set to an instance of an object." error... FYI PageId is a Guid reference to a page.
Any help would be greatly appreciated.
Found the issue. PageNode requires "Telerik.Sitefinity.Pages.Model" as a reference. I had that, but later found that you ALSO need to include "Telerik.Sitefinity.Modules.Pages".
This adds a new method to my belt which I've used below (getFullUrl):
PageNode page = App.WorkWith().Page(PageId).Get();
PageLink.Text = page.Title;
PageLink.NavigateUrl = page.GetFullUrl();
Thanks