Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Aspose.PDF-Cloud-SDK-Java code snippets
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-java
const string clientID = "xxxxxx-1c8e-4ea4-a948-3857547232fa";
const string clientSecret = "xxxxxx613237f013e329cdf5694cc96a";
import com.aspose.asposecloudpdf.ApiException;
import com.aspose.asposecloudpdf.api.PdfApi;
import com.aspose.asposecloudpdf.examples.Common;
import com.aspose.asposecloudpdf.model.FieldResponse;
public class GetFieldTestExample {
public static void main(String[] args) throws ApiException {
String name = "PdfWithAcroForm.pdf";
// create an instance of PdfAPi object
com.aspose.asposecloudpdf.api.PdfApi pdf = new com.aspose.asposecloudpdf.api.PdfApi(clientSecret,clientID);
// Read document TextBox fields
TextBoxFieldsResponse response = pdf.getDocumentTextBoxFields("FormDataTextBox.pdf",null, null);
// print the details regarding fetched fields
System.out.println(response.getFields());
}
}
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-java
const string clientID = "xxxxxx-1c8e-4ea4-a948-3857547232fa";
const string clientSecret = "xxxxxx613237f013e329cdf5694cc96a";
import com.aspose.asposecloudpdf.model.Rectangle;
import com.aspose.asposecloudpdf.model.CheckBoxField;
import com.aspose.asposecloudpdf.model.Border;
import com.aspose.asposecloudpdf.model.Color;
import com.aspose.asposecloudpdf.model.CheckBoxFieldResponse;
public class UpdateCheckBoxFieldExample {
public static void main(String[] args) throws ApiException {
// create an instance of PdfAPi object
com.aspose.asposecloudpdf.api.PdfApi pdf = new com.aspose.asposecloudpdf.api.PdfApi(clientSecret,clientID);
// Create CheckBox instance
CheckBoxField updatedCheckBox = new CheckBoxField();
updatedCheckBox.partialName("Check Box1");
updatedCheckBox.height(12.0);
updatedCheckBox.width(12.0);
// set checkbox style as Diamond
updatedCheckBox.style(com.aspose.asposecloudpdf.model.BoxStyle.DIAMOND);
updatedCheckBox.activeState("On");
// enable the checkbox value
updatedCheckBox.checked(true);
Rectangle rect = new Rectangle();
rect.setLLX(88.3573);
rect.setLLY(687.617);
rect.setURX(97.0198);
rect.setURY(695.413);
updatedCheckBox.rect(rect);
// specify the page index details
updatedCheckBox.pageIndex(1);
// set CheckBox border style details
Border border = new Border();
border.width(1);
border.style(com.aspose.asposecloudpdf.model.BorderStyle.SOLID);
border.effect(com.aspose.asposecloudpdf.model.BorderEffect.NONE);
// Color object for border
Color color = new Color();
color.setR(120);
color.setG(220);
color.setB(10);
// set CheckBox border color
border.color(color);
// call method to update checkbox field on page 1
CheckBoxFieldResponse response = pdf.putCheckBoxField("FormDataTextBox.pdf", "Check Box1", updatedCheckBox,null,null);
// print response status code
System.out.print(response.getStatus());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment