I am using GWT2.4 version in my application.In this I application I have created Form using GWT control (like textbox,textaera).
I have also created preview of form.In that preview I have button of pdf generation. Now I want to create behavior to deal with pdf link same as browsers(Mozilla/chrome). For example in Mozilla on click of pdf link it asks for either save or open in a pop up window.
While debugging I found a jar name iText which can be used to create pdf, I want to implement browsers behavior in this also. Please help me out. Thanks in advance.
I included it below:
----
public final class FormBuilder {
private FormPanel formPanel;
public FormBuilder() {
}
public FormBuilder(final Method method, final String action, final
String target) {
setMethod(method);
setAction(action);
setTarget(target);
}
public void submit() {
try {
RootPanel.get().add(getEnsureFormPanel());
getEnsureFormPanel().submit();
}
finally {
RootPanel.get().remove(getEnsureFormPanel());
}
}
public void setAcceptedCharset(final String charsets) {
getEnsureFormPanel().getElement().setAttribute("accept-charset",
charsets);
}
public void setAction(final String action) {
getEnsureFormPanel().setAction(action);
}
public void setMethod(final Method method) {
getEnsureFormPanel().setMethod(method.getValue());
}
public void setTarget(final String target) {
getEnsureFormPanel().getElement().setAttribute("target", target);
}
public void addValue(final String name, final String value) {
final InputElement el = Document.get().createTextInputElement();
getEnsureFormPanel().getElement().appendChild(el);
el.setName(name);
el.setValue(value);
}
public void removeAllValues() {
final int size = getEnsureFormPanel().getElement().getChildCount();
if (size > 0) {
for (int i = size - 1; i >= 0; i--) {
getEnsureFormPanel().getElement().getChild(i).removeFromParent();
}
}
}
//
//
private FormPanel getEnsureFormPanel() {
if (this.formPanel == null) {
this.formPanel = new FormPanel();
this.formPanel.getElement().getStyle().setDisplay(Display.NONE);
}
return this.formPanel;
}
/**
*/
public enum Method {
POST("POST"), GET("GET");
private final String value;
private Method(final String methodName) {
this.value = methodName;
}
public String getValue() {
return this.value;
}
}
if u want to create pdf document then u can directly create pdf without using iText jar ...u should use apache pdf jar file on serverside code.u can also create by using amazon web services.