Customising PDFTRON Signature tool in Webviewer - signature

I have been exploring pdftron for my website on my trial version,but I could not find any specific examples for customising the signature tool,Any help appreciated.

This guide provides information about the signature tool and some of the APIs available https://www.pdftron.com/documentation/web/guides/advanced/signature
For example here's a code snippet from the guide about how to customize the sign here element.
var createSignHereElement = Annotations.SignatureWidgetAnnotation.prototype.createSignHereElement;
Annotations.SignatureWidgetAnnotation.prototype.createSignHereElement = function() {
// signHereElement is the default one with dark blue background
var signHereElement = createSignHereElement.apply(this, arguments);
signHereElement.style.background = 'red';
return signHereElement;
}
If you want to do more complicated customizations to the UI, the WebViewer UI components are all open source and able to be modified. Here is a link to the SignatureModal component that can get you started https://github.com/PDFTron/webviewer-ui/tree/master/src/components/SignatureModal
This guide discusses how to edit and run the UI https://www.pdftron.com/documentation/web/guides/ui/advanced-customization

Related

OfficeJs - Get Font/Theme colors of excel/powerpoint file

How can i get excel/powerpoint theme colors in font settings via officeJs?
Is it possible at all?
I need first row, but if i get all rows it is not problem.
You may have a try Office.OfficeTheme API, see if this API works for you. the document can be found at https://learn.microsoft.com/en-us/javascript/api/office/office.officetheme?view=word-js-preview,
function applyOfficeTheme(){
// Get office theme colors.
var bodyBackgroundColor = Office.context.officeTheme.bodyBackgroundColor;
var bodyForegroundColor = Office.context.officeTheme.bodyForegroundColor;
var controlBackgroundColor = Office.context.officeTheme.controlBackgroundColor;
var controlForegroundColor = Office.context.officeTheme.controlForegroundColor;
// Apply body background color to a CSS class.
$('.body').css('background-color', bodyBackgroundColor);
}
if this doesnt work for you, that should be a new feature ask, and then you could submit your request in uservoice and upvote for this feature at https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback?category_id=163563. and upvote for this feature. thanks for your support

Google file picker Recent tab

I got a Google drive picker item on my web app. Looking at Google Docs I find out the it display one option tab called "Recent".
Following the documentation at https://developers.google.com/picker/docs/reference I couldn't find any reference to this tab mode, only found "Recently Picked" for files I recently picked from the picker, but I'm looking to emulate this function.
My current code is
new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.enableFeature(google.picker.Feature.SUPPORT_TEAM_DRIVES)
.setAppId(appId)
.setOAuthToken(oauthToken)
.addView(new google.picker.DocsView().setIncludeFolders(true).setOwnedByMe(true))
.addView(new google.picker.DocsView().setIncludeFolders(true).setOwnedByMe(false))
.addView(new google.picker.DocsView().setStarred(true).setLabel('Starred'))
finally after reading the documentation of Google picker and the google groups dedicated to it, I figured out that there is no preset or config for recent uploaded files and even trying to build a custom view with google.picker.view, the query field is quite limited and didn't allow the option to sort the files.
After reading the javascript code of docs.google.com for the file picker I found few variables that are accessible in the moment when you call the method .addView(). This field are:
El: is the filter type for the document type.
mc: this old the whole view configuration and fields. Example: mc.query is equivalent for the View.setQuery.
xd: this field manage the View title in the top nav tab title.
While this method is a bit hacky, is the only option I got in the meantime to replicate the "recent" view tab from google docs. Here is the code I used:
let recentView = new google.picker.DocsView();
recentView.xd = 'Recent';
recentView.mc.sortKey = 15;
let picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.enableFeature(google.picker.Feature.SUPPORT_TEAM_DRIVES)
.setAppId(appId)
.setOAuthToken(oauthToken)
.addView(new google.picker.DocsView().setIncludeFolders(true).setOwnedByMe(true))
.addView(new google.picker.DocsView().setIncludeFolders(true).setOwnedByMe(false))
.addView(new google.picker.DocsView().setIncludeFolders(true).setStarred(true).setLabel('Starred'))
.addView(recentView)
.addView(new google.picker.DocsUploadView().setIncludeFolders(true))
.setDeveloperKey(developerKey)
.setCallback(onFilePickerCB)

Coded UI: Find Element(s) by CSS Selector

I am trying to build out a harness for a page so that we can write tests against it. What I would like to be able to do is use a CSS selector to find the given element or elements instead of manually modifying the SearchProperties or FilterProperties.For a web test the CSS Selector seems far more intuitive then the SearchProperties do. Is there some mechanism for doing this that I am simply not seeing?
Try this...
https://github.com/rpearsondev/CodedUI.jQueryExtensions/
It adds extension methods to the BrowserWindow object...
var example1 = browser.JQuerySelect<HtmlHyperlink>('a.class1');
var example2 = browser.JQuerySelect<HtmlListItem>('li.class2');
However, I will let you know I'm having issues with it complaining about casting errors regularly.
Try browserWindow.executeJavascript if you return a control you found via css/xpath it returns the relevant uiControl object
const string javascript = "document.querySelector('{0}');";
var bw = BrowserWindow.Launch(new Uri("http://rawstack.azurewebsites.net"));
string selector = "[ng-model='filterOptions.filterText']";
var control = bw.ExecuteScript(string.Format(javascript,selector));
HtmlEdit filter= control as HtmlEdit;
filter.Text = "Alien";
As sjdirect noted, the jQuery extensions are probably the way to go if you want to use those type of selectors.
However, it seems that you may be interested in some abstraction that doesn't require directly setting search / filter properties on the UITestControl objects.
There are good abstractions that do not use the same selectors as jQuery, but provide a readable, consistent approach for finding elements in the page and interacting with them.
I would recommend also looking into Code First and CodedUI Fluent (I wrote the fluent extensions) or even CodedUI Enhanced (CUITe).
These provide query support for that looks like (from CUITe):
// Launch the web browser and navigate to the homepage
BrowserWindowUnderTest browserWindow = BrowserWindowUnderTest.Launch("https://website.com");
// Enter the first name
browserWindow.Find<HtmlEdit>(By.Id("FirstName")).Text = "John";
// Enter the last name
browserWindow.Find<HtmlPassword>(By.Id("LastName")).Text ="Doe";
// Click the Save button
browserWindow.Find<HtmlInputButton>(By.Id("Save")).Click();

Vaadin - SVG Generator, any alternative?

I have been working with Vaadin charts during this week and I found a problem that I cannot solve. I need to send several charts to a PDF generation (using iTextpdf) and I could do it using SVGGenerator. The main problem is I cannot use this solution because the final laptop doesn't allow any installation, and Phantomjs is required for SVG Generator (no add-on can be installed neither). I tried to find a different solution to convert the chart content into file or buffer that I can manage, but I think I have been reading so much posts and I am not able to distinguish the solution.
So, I will try to clarify basic questions first:
a) Is it possible to manage SVG Generator without any installation in the laptop?
b) If not, is there a different way to convert a chart into an object which class could be managed to insert it into a PDF?
I can assure you I tried to read all documentation in this forum and official Vaadin forum related to this topic but I couldn't find any solution. I don't want to seem lazy, I only want to avoid spending more time and clarify the maining pre-conditions to solve this issue.
thanks in advance for your time and help.
Kind regards,
David.
You can take a screenshot of your chart and append it to pdf:
Screenshot screenshot = new Screenshot();
screenshot.setTargetComponent(myTargetComponent);
myChartLayout.addComponent(screenshot);
//when complete
screenshot.addScreenshotListener(new ScreenshotListener() {
public void screenshotComplete(ScreenshotImage image) {
//do something
}
});
//take screenshot
screenshot.takeScreenshot();
You will not be able to render a Vaadin Chart without a web browser engine of some kind. That's what PhantomJS provides. If you have a full-blown web browser at your disposal, though, you can grab the SVG markup manually from there; it's just a bit more difficult to automate. This works in Chrome:
Open your Charts app in the browser
Open the JavaScript console (Ctrl/Cmd + Shift + J)
Type something like this: copy(document.getElementsByTagName('svg')[0].outerHTML)
Paste the contents of your clipboard to a new text file and save it as an SVG.
You don't need to install phantomjs, just bundle its binary along with your web application (Reference). I did the same thing with my Amazon AWS deployment and it works just fine.

How to print a pdf file from windows store application

I am creating a windows 8 app in c# and xaml.
How can i print a pdf file on my system from this app without launching the pdf reader of windows.
If a commercial library is an option, you could try Amyuni PDF Creator for WinRT.
From the documentation, the code for printing a PDF file in C# using this library would look like this:
// Printing on a XAML Windows Store Application
// The field AmyuniPDFCreator.PDFCreator m_pdfCreator; contains an instance of the PDFCreator control
TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> m_printTaskRequestedEventToken;
// Registering the Application View for printing
void RegisterForPrinting()
{
// Request a PrintManager instance
PrintManager printMan = PrintManager.GetForCurrentView();
// Add a handler for printing events.
m_printTaskRequestedEventToken = printMan.PrintTaskRequested += m_pdfCreator.Document.PrintTaskRequestedEventHandler;
}
// Unregistering the Application View for printing
void UnregisterForPrinting()
{
// Remove the handler for printing events.
PrintManager printMan = PrintManager.GetForCurrentView();
printMan.PrintTaskRequested -= m_printTaskRequestedEventToken;
}
More details about the library can be found here.
Disclaimer: I currently work as a developer of the library
It is possible to achieve this without any third party library if you want to print it with a device.
This isn't working to create or write a ".pdf"[Pdf File). To make this happen without another library you could maybe try to write images directly into a pdf, but i can only reference here the Pdf Documentation.
First of all you have to render your pdf. You can do this with Windows.Data.Pdf.
You can take a look at an example here. The libary will handle the Pdf and you get some BitmapImages rendered.
This library can read, but not write ".pdf"
Now you have to print your Images(rendered pdf pages). For this you take the Windows.Graphics.Printing.PrintManager.
I would not recommend the msdn example in this case.
So have a first look at Windows Store Apps and XAML Based Printing.
And you will find another printing example with MVVM here: Printing from MVVM XAML Windows 8 Store apps.
If you just follow the examples you will achieve to print a pdf on paper some trouble.
How to add custom settings for your printer is explained at How to add custom settings to the print preview UI (XAML)!
Windows 8 doesn't have an API to do this, so you'll have to acquire one elsewhere - something that's capable of properly rendering a PDF for you, and that's going to mean a full-blown PDF API with all the bells and whistles (I'm not aware of any of these for Windows 8 that only supports printing).
If only PDF Sharp had a WinRT version, I'd recommend it in a heartbeat... unfortunately it doesn't (yet). Only ones I know of that have an API for WinRT are Foxit and Siberix Report Writer.

Resources