Friday, May 27, 2022

Alternative to Print-Sign-Scan

This blog will provides alternative way to avoid time taking route to manage a way to send signed scan document.

Steps to follow : 

1. In blank paper, write your signature

2. Take close photo of a signature



3. Open Document where you want to sign and paste image of your signature. 




4. Once image of your signature pasted, as shown in below screenshot :
  • Click on picture > Format Picture > Picture Color > Presets > Select red highlighted option


5. The final document would look like below, then click on "Save As" and save the document as PDF




6. Signed PDF File will look like this and you can send to intended reecipients



Thursday, December 10, 2015

Twitter style Image Cropping tool



This asset provides a functionality same as available in twitter. I used and modified functionalities available on jWindowcrop plugin to give it a look and feel same as in twitter. For that integration has been done with JQuery Dialog and JQuery Slider widgets.

Steps to follow:

Implement File upload code which uploads file and in response it returns the file which can be viewable on browser.
Here I have developed servlet “UploadImage” which uploads file on server and return back javascript code as an output stream.
This below particular code does following tasks:
  •        Opening JQuery Dialog
  •        Setting imagePath in target3 variable needed for jWindowCrop plugin


out.println("<script type=\"text/javascript\">"); 
out.println("parent.document.getElementById('browsehidden').src='"+imagePath+"';parent.displayImageDialog();parent.document.getElementById('target3').src='"+imagePath+"';");
out.println("</script>"); 

Once this code executes it displays the uploaded image in plugin.



Modifications Done on Original Plugin : Below screen demonstrates the original plugin view.
By using jQuery slider widget I have handled zoom in-zoom out events for that plugin. And put this plugin in JQuery Dialog control and applied look and feel using CSS and Images. Finally on changing its dimensions clicking on apply will give you co-ordinates that you can use to crop an Image.

Below images describes the comparison.
Twitter : Upload profile picture tool

·         Developed Upload profile picture tool

Sample Page:


References:


Thursday, May 22, 2014

Integrating PayPal with Java WebApplication

Hello All ...

In my personal experience integration of PayPal is very confusing because of various API's available by which we can integrate PayPal with the website. The chances of getting diverted while implementation of one of them is very high.

Instant Payment Notification(IPN) is a message service that notifies you of events related to PayPal transactions (Introduction)

Lets see how to integrate PayPal IPN service with java web-application.

For that first you need to create Business account at PayPal Developer site which will accept payment.


After sign up and confirmation via Email you are ready to go to next step to generate Payment Button.

We will select here the first option "On your website"


Now create button as per your choice(e.g. BuyNow, Donate, Pay Now etc.)  to be integrated within your application




After completing this process you have to select and copy the button code that you have to put in your application.

After that you can see button like below within your webpage



Login again to PayPal site and go to Applicaion > SandboxAccounts . At there get facilitator account credentials.



Login with facilitator account credentials into sandbox.paypal.com


Under My selling tools select Instant payment notification and update IPN url



After that select "choose IPN settings" and update notification URL. This URL will be the controller  of your web application which will receive messages from PayPal

Now its time to create app in PayPal on behalf of which application will receive payments,For that Login again to PayPal Developer site and go to Applications > MyApps > Create App

Now you are ready to test payment transactions using PayPal ...

Change form parameters within you web page ( update generated "Buy Now" button code with following changes )
  • Add parameter business with facilitator account Id
  • change form action from "https://www.paypal.com/cgi-bin/webscr" to "https://www.sandbox.paypal.com/cgi-bin/webscr" for test mode
  • change cmd valut to "_xclick"
  • Put notifyurl and returnurl same as you mentioned while choosing IPN Notification settings
  • You can use Custom parameter by which you can pass and get back values while using PayPal


This is how final form looks(You can un-comment needed parameters)



After clicking on  button and on successful payment (Payment can be done with different test account created through paypal) you will receive payment status,transaction Id and custom parameters




String txn_id = request.getParameter("txn_id");   //e.g. 3EM711.....804011F
String payment_status = request.getParameter("payment_status"); //e.g. Completed
String custom = request.getParameter("custom"); // parameters that you pass and get back

That's it..!! Your Payment has been Successful... :D