Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-pdf/2605f3d097921d61b665d23e70aa16a3 to your computer and use it in GitHub Desktop.
Save aspose-pdf/2605f3d097921d61b665d23e70aa16a3 to your computer and use it in GitHub Desktop.
Aspose_PDF_Cloud_JAVA
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ApendPDFFileExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all annotations from pdf page
AnnotationsResponse apiResponse = pdfApi.GetPageAnnotations(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for (Link annotatonLink : apiResponse.getAnnotations().getLinks())
{
System.out.println("Annotation Link :: " + annotatonLink.getHref());
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ApendPDFFileExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get annotations count from Pdf page
AnnotationsResponse apiResponse = pdfApi.GetPageAnnotations(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
int count = apiResponse.getAnnotations().getLinks().size();
System.out.println("Annotation Count :: " + count);
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
int pageNumber = 1;
int annotationNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetSpecificAnnotationExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get specific annotation from pdf page
AnnotationResponse apiResponse = pdfApi.GetPageAnnotation(fileName, pageNumber, annotationNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Annotation annotation = apiResponse.getAnnotation();
System.out.println("Annotation Content" + annotation.getContents());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "SampleAttachment";
String fileName = name + ".pdf";
int attachmentIndex = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(DownloadASpecificAttachmentExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to download specific attachment from a pdf
ResponseMessage apiResponse = pdfApi.GetDownloadDocumentAttachmentByIndex(fileName, attachmentIndex, storage, folder);
if (apiResponse != null)
{
System.out.println("Download a specific Attachment from a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "SampleAttachment.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetAllBookmarksExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all attachments from a pdf
AttachmentsResponse apiResponse = pdfApi.GetDocumentAttachments(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Get all Attachments from a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "SampleAttachment.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetAttachmentCountExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get attachment count from a pdf
AttachmentsResponse apiResponse = pdfApi.GetDocumentAttachments(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Attachments attachments = apiResponse.getAttachments();
int count = attachments.getList().size();
System.out.println("Count :: " + count);
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "SampleAttachment";
String fileName = name + ".pdf";
int attachmentIndex = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetAllBookmarksExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get specific attachment from a pdf
AttachmentResponse apiResponse = pdfApi.GetDocumentAttachmentByIndex(fileName, attachmentIndex, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Attachment attach = apiResponse.getAttachment();
System.out.println("Name :: " + attach.getName());
System.out.println("MimeType :: " + attach.getMimeType());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Bookmark.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetAllBookmarksExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all bookmarks from pdf
BookmarksResponse apiResponse = pdfApi.GetDocumentBookmarks(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Bookmarks bookmarks = apiResponse.getBookmarks();
System.out.println("Get all Bookmarks from a PDF,Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Bookmark.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ApendPDFFileExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get bookmark count from pdf
BookmarksResponse apiResponse = pdfApi.GetDocumentBookmarks(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Bookmarks bookmarks = apiResponse.getBookmarks();
int count = bookmarks.getList().size();
System.out.println("Bookmark Count :: " + count);
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "Sample-Bookmark.pdf";
String storage = "";
String folder = "";
String bookmarkPath = null;
Path inputFile = Utils.getPath(GetAllBookmarksExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API
BookmarkResponse apiResponse = pdfApi.GetDocumentBookmarksChildren(fileName,bookmarkPath, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Bookmark bookmarks = apiResponse.getBookmark();
System.out.println("Get all Bookmarks from a PDF,Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Bookmark.pdf";
String bookmarkPath = "1";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ApendPDFFileExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get specific bookmark
BookmarkResponse apiResponse = pdfApi.GetDocumentBookmarksChildren(fileName, bookmarkPath, storage, folder);
if (apiResponse != null)
{
System.out.println("Get Specific Bookmark from a PDF,Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
public static final String apiKey="a165298dc077f8852d5eb6e5bf49310d";
public static final String appSID="1c7a12ca-efa8-466e-b83d-234d9d5e2309";
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample.pdf";
String appendFile = null;
int startPage = 2;
int endPage = 3;
String storage = "";
String folder = "";
String appendFileName = "sample-input.pdf";
AppendDocument body = new AppendDocument();
body.setDocument (appendFileName);
body.setStartPage (2);
body.setEndPage (3);
Path inputFile = Utils.getPath(ApendPDFFileExample.class, fileName);
Path appendFilePath = Utils.getPath(ApendPDFFileExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
storageApi.PutCreate(appendFileName, "", "",appendFilePath.toFile());
// Invoke Aspose.PDF Cloud SDK API to append pdf file
DocumentResponse apiResponse = pdfApi.PostAppendDocument(fileName, appendFile, startPage, endPage, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Append PDF Files, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "123";
String fileName = name + ".pdf";
String format = "TIFF";
String url = "https://github.com/farooqsheikhpk/Aspose_Pdf_Cloud/raw/master/SDKs/Aspose.Pdf_Cloud_SDK_for_Java/src/test/resources/" + fileName;
String outPath = "";
Path inputFile = Utils.getPath(CreateEmptyPDFExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
ResponseMessage apiResponse = pdfApi.PutConvertDocument(format, url, outPath, inputFile.toFile());
if (apiResponse != null)
{
System.out.println("Convert PDF from Remote Server to TIFF, Done!");
}
format = "DOC";
// Invoke Aspose.PDF Cloud SDK API to pdf file to doc format
apiResponse = pdfApi.PutConvertDocument(format, url, outPath, inputFile.toFile());
if (apiResponse != null)
{
System.out.println("Convert PDF from Remote Server to DOC, Done!");
}
format = "HTML";
// Invoke Aspose.PDF Cloud SDK API to convert pdf to HTML format
apiResponse = pdfApi.PutConvertDocument(format, url, outPath, inputFile.toFile());
if (apiResponse != null)
{
System.out.println("Convert PDF from Remote Server to HTML, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "input.pdf";
String format = "TIFF";
String url = "";
String outPath = "";
Path inputFile = Utils.getPath(CreateEmptyPDFExample.class, fileName);
try {
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to convert pdf to other formats
ResponseMessage apiResponse = pdfApi.PutConvertDocument(format, url, outPath, inputFile.toFile());
if (apiResponse != null) {
System.out.println("Convert PDF to TIFF, Done!");
}
format = "DOC";
apiResponse = pdfApi.PutConvertDocument(format, url, outPath, inputFile.toFile());
if (apiResponse != null) {
System.out.println("Convert PDF to DOC, Done!");
}
format = "html";
apiResponse = pdfApi.PutConvertDocument(format, url, outPath, inputFile.toFile());
if (apiResponse != null) {
System.out.println("Convert PDF to HTML, Done!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "input.pdf";
String format = "TIFF";
String storage = "";
String folder = "";
String outPath = "";
Path inputFile = Utils.getPath(CreateEmptyPDFExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to convert pdf to images
ResponseMessage apiResponse = pdfApi.GetDocumentWithFormat(fileName, format, storage, folder, outPath);
if (apiResponse != null)
{
System.out.println("Convert PDF to TIFF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "input.pdf";
String templateFile = "";
String dataFile = "";
String templateType = "";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreateEmptyPDFExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to create empty pdf file
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create Empty PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-java
String fileName = "input.pdf";
String templateFile = "sample.html";
String dataFile = "";
String templateType = "html";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(templateFile, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to create pdf file from HTML
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create Empty HTML, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-tiff.pdf";
String templateFile = "Sample.tiff";
String dataFile = "";
String templateType = "tiff";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromJPGExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(templateFile, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to create pdf from TIFF
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create PDF from TIFF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-tiff.pdf";
String templateFile = "Sample.tiff";
String dataFile = "";
String templateType = "tiff";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromJPGExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(templateFile, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to create pdf from TIFF
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create PDF from TIFF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "input.pdf";
String templateFile = "sample.xsl";
String dataFile = "sample.xml";
String templateType = "xml";
String storage = "";
String folder = "";
Path templateFilePath = Utils.getPath(CreatePDFFromXMLExample.class, templateFile);
Path dataFilePath = Utils.getPath(CreatePDFFromXMLExample.class, dataFile);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(templateFile, "", "", templateFilePath.toFile());
storageApi.PutCreate(dataFile, "", "", dataFilePath.toFile());
// Invoke Aspose.PDF Cloud SDK API to create Pdf from XML
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create PDF from XML, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-svg.pdf";
String templateFile = "Example.svg";
String dataFile = "";
String templateType = "svg";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromJPGExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(templateFile, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to create pdf from SVG
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create PDF from SVG, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ApendPDFFileExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all annotations from pdf page
WordCountResponse apiResponse = pdfApi.GetWordsPerPage(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for (PageWordCount PageWordCount : apiResponse.getWordsPerPage().getList())
{
System.out.println("Page Number :: " + PageWordCount.getPageNumber() + " Total Words :: " + PageWordCount.getCount());
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-merged.pdf";
String storage = "";
String folder = "";
MergeDocuments body = new MergeDocuments();
String[] fileNames={ "sample.pdf", "input.pdf" };
body.setList(Arrays.asList(fileNames)) ;
Path sampleFilePath = Utils.getPath(MergeMultiplePDFFiles.class, "sample.pdf");
Path dataFilePath = Utils.getPath(MergeMultiplePDFFiles.class, "input.pdf");
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate("sample.pdf", "", "", sampleFilePath.toFile());
storageApi.PutCreate("input.pdf", "", "", dataFilePath.toFile());
// Invoke Aspose.PDF Cloud SDK API to merge pdf files
DocumentResponse apiResponse = pdfApi.PutMergeDocuments(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Merge Multiple PDF Files, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-input.pdf";
String signatureFileName = "pkc7-sample.pfx";
int pageNumber = 1;
String storage = "";
String folder = "";
Signature body = new Signature();
body.setAuthority( "Naeem Akram");
body.setLocation ( "Gojra");
body.setContact( "naeem.akram@aspose.com");
body.setDate ("06/24/2015 2:00:00.000 AM");
body.setFormFieldName ( "Signature1");
body.setPassword ( "aspose");
Rectangle rect = new Rectangle();
rect.setX (100);
rect.setY (100);
rect.setHeight ( 100);
rect.setWidth ( 200);
body.setRectangle ( rect);
body.setSignaturePath( signatureFileName);
body.setSignatureType ( "PKCS7");
body.setVisible(true);
Path inputFile = Utils.getPath(SignPDFDocumentsExample.class, fileName);
Path signitureFilePath = Utils.getPath(SignPDFDocumentsExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
storageApi.PutCreate(signatureFileName, "", "", signitureFilePath.toFile());
// Invoke Aspose.PDF Cloud SDK API to sign Pdf document
SaaSposeResponse apiResponse = pdfApi.PostSignPage(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Sign PDF Documents, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
String signatureFileName = "pkc7-sample.pfx";
int pageNumber = 1;
String storage = "";
String folder = "";
Signature body = new Signature();
body.setAuthority( "Naeem Akram");
body.setLocation ( "Gojra");
body.setContact( "naeem.akram@aspose.com");
body.setDate ("06/24/2015 2:00:00.000 AM");
body.setFormFieldName ( "Signature1");
body.setPassword ( "aspose");
Rectangle rect = new Rectangle();
rect.setX (100);
rect.setY (100);
rect.setHeight ( 100);
rect.setWidth ( 200);
body.setRectangle ( rect);
body.setSignaturePath( signatureFileName);
body.setSignatureType ( "PKCS7");
body.setVisible(true);
Path inputFile = Utils.getPath(SignPDFDocumentsExample.class, fileName);
Path signitureFilePath = Utils.getPath(SignPDFDocumentsExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
storageApi.PutCreate(signatureFileName, "", "", signitureFilePath.toFile());
// Invoke Aspose.PDF Cloud SDK API to sign Pdf document
SaaSposeResponse apiResponse = pdfApi.PostSignPage(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Sign PDF Documents, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "input.pdf";
String format = "pdf";
int from = 1;
int to = 2;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to split pdf files
SplitResultResponse apiResponse = pdfApi.PostSplitDocument(fileName, format, from, to, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Split PDF Files, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-field.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreateFormFieldExample.class, fileName);
Field body = new Field();
Link link = new Link();
link.setHref("http://api.aspose.cloud/v1.1/pdf/ABFillablewfields.pdf/fields/NewField");
link.setRel("self");
link.setTitle("NewField");
link.setType("link");
Rectangle rect = new Rectangle();
rect.setX(0);
rect.setY(0);
body.setName("dvDate_1");
body.setValues(new ArrayList<>(Arrays.asList("NewFieldValue")));
body.setRect(rect);
body.setSelectedItems(new ArrayList<>(Arrays.asList(1)));
body.setType(0);
body.setLinks(new ArrayList<>(Arrays.asList(link)));
try {
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all fields from pdf
// document
SaaSposeResponse apiResponse = pdfApi.PostCreateField(fileName, 1, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK")) {
System.out.println("Get all Form Fields from the PDF Document, Done!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Clouds
String fileName = "sample-field.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(MovePDFToNewLocation.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all fields from pdf document
FieldsResponse apiResponse = pdfApi.GetFields(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for (Field field : apiResponse.getFields().getList())
{
System.out.println("Name:" + field.getName());
System.out.println("Value:" + field.getValues().get(0));
}
System.out.println("Get all Form Fields from the PDF Document, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-field.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get field count
FieldsResponse apiResponse = pdfApi.GetFields(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
int count = apiResponse.getFields().getList().size();
System.out.println("Count" + count);
System.out.println("Get Form Field Count from a PDF Document, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-field.pdf";
String fieldName = "textbox1";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get particular field
FieldResponse apiResponse = pdfApi.GetField(fileName, fieldName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Field field = apiResponse.getField();
System.out.println("Name" + field.getName());
System.out.println("Value" + field.getValues().get(0));
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-field.pdf";
String fieldName = "textbox1";
String storage = "";
String folder = "";
Field body = new Field();
body.setName ("textbox1");
String[] names={ "Aspose" };
body.setValues(Arrays.asList(names));
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to update form field
FieldResponse apiResponse = pdfApi.PutUpdateField(fileName, storage, folder, fieldName, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
Field field = apiResponse.getField();
System.out.println("Name" + field.getName());
System.out.println("Value" + field.getValues().get(0));
System.out.println("Update a Form Field in a PDF Document, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to add new page
DocumentPagesResponse apiResponse = pdfApi.PutAddNewPage(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Add a New Page in PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "sample-input";
String fileName = name + ".pdf";
int pageNumber = 1;
String format = "jpeg";
int width = 0;
int height = 0;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to convert pdf page to image with defualt size
ResponseMessage apiResponse = pdfApi.GetPageWithFormat(fileName, pageNumber, format, width, height, storage, folder);
if (apiResponse != null)
{
System.out.println("Convert a PDF Page to Image with Default Size, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "sample-input";
String fileName = name + ".pdf";
int pageNumber = 1;
String format = "jpeg";
int width = 300;
int height = 300;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to convert pdf page to image with specified size
ResponseMessage apiResponse = pdfApi.GetPageWithFormat(fileName, pageNumber, format, width, height, storage, folder);
if (apiResponse != null)
{
System.out.println("Convert a PDF Page to Image with Specified Size, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to delete page from Pdf
SaaSposeResponse apiResponse = pdfApi.DeletePage(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Delete Page from PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK
ResponseMessage apiResponse = pdfApi.GetPage(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Delete Page from PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(MovePDFToNewLocation.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get page count from pdf document
DocumentPagesResponse apiResponse = pdfApi.GetPages(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
int count = apiResponse.getPages().getList().size();
System.out.println("Total Page Count :: " + count);
System.out.println("Get PDF Document Page Count, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-merged.pdf";
int pageNumber = 1;
int newIndex = 2;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(MovePDFToNewLocation.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to move pages to new location
SaaSposeResponse apiResponse = pdfApi.PostMovePage(fileName, pageNumber, newIndex, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Move PDF Pages to New Locations in a PDF File, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get all document properies
DocumentPropertiesResponse apiResponse = pdfApi.GetDocumentProperties(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for (DocumentProperty docProp : apiResponse.getDocumentProperties().getList())
{
System.out.println(docProp.getName() + " :: " + docProp.getValue());
}
System.out.println("Get All Document Properties from a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
String propertyName = "Creator";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(MovePDFToNewLocation.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get particular document property
DocumentPropertyResponse apiResponse = pdfApi.GetDocumentProperty(fileName, propertyName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
DocumentProperty docProp = apiResponse.getDocumentProperty();
System.out.println(docProp.getName() + " :: " + docProp.getValue());
System.out.println("Get a Particular Document Property from a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(MovePDFToNewLocation.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to remove all document properties
SaaSposeResponse apiResponse = pdfApi.DeleteProperties(fileName, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Remove All Document Properties from a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "Sample-Annotation.pdf";
String propertyName = "author";
String storage = "";
String folder = "";
DocumentProperty body = new DocumentProperty();
body.setName ("author");
body.setValue ("Naeem Akram");
body.setBuiltIn (true);
Path inputFile = Utils.getPath(CreatePDFFromHtmlExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to set single pdf document property
DocumentPropertyResponse apiResponse = pdfApi.PutSetProperty(fileName, propertyName, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
DocumentProperty docProp = apiResponse.getDocumentProperty();
System.out.println(docProp.getName() + " :: " + docProp.getValue());
System.out.println("Set a Single Document Property in a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-jpeg.pdf";
String templateFile = "Einstein_JPEG.jpg";
String dataFile = "";
String templateType = "jpeg";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(CreatePDFFromJPGExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(templateFile, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to create pdf from JPEG
DocumentResponse apiResponse = pdfApi.PutCreateDocument(fileName, templateFile, dataFile, templateType, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Create PDF from JPEG, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String format = "jpeg";
int width = 0;
int height = 0;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to extract particular image with default size
ResponseMessage apiResponse = pdfApi.GetImageWithFormat(fileName, pageNumber, imageNumber, format, width, height, storage, folder);
if (apiResponse != null)
{
System.out.println("Extract a Particular Image from a PDF Page with Default Size, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String format = "jpeg";
int width = 200;
int height = 200;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to extract particular image with specified size
ResponseMessage apiResponse = pdfApi.GetImageWithFormat(fileName, pageNumber, imageNumber, format, width, height, storage, folder);
if (apiResponse != null)
{
System.out.println("Extract a Particular Image from a PDF Page with Specified Size, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "SampleImage.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get image count
ImagesResponse apiResponse = pdfApi.GetImages(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
int count = apiResponse.getImages().getList().size();
System.out.println("Image Count " + count);
System.out.println("Get Image Count from a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "Lenovo_Tablet_2_Datasheet.pdf";
Integer pageNumber = 1;
Integer imageNumber = 1;
String format = "jpeg";
Integer width = 0;
Integer height = 0;
String storage = null;
String folder = null;
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get image count
ResponseMessage apiResponse = pdfApi.GetImageWithFormat(fileName, pageNumber, imageNumber, format, width, height, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Get Image Count from a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String imageFile = "aspose-cloud.png";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetImageCountFromPDFPage.class, fileName);
try {
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace image using local
// image stream
ImageResponse apiResponse = pdfApi.PostReplaceImage(fileName, pageNumber, imageNumber, imageFile, storage,
folder, inputFile.toFile());
if (apiResponse != null && apiResponse.getStatus().equals("OK")) {
System.out.println("Replace Image in a PDF file using Local Image Stream, Done!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String imageFile = "aspose-cloud.png";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(GetImageCountFromPDFPage.class, fileName);
try {
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace image using image file
ImageResponse apiResponse = pdfApi.PostReplaceImage(fileName, pageNumber, imageNumber, imageFile, storage,
folder, inputFile.toFile());
if (apiResponse != null && apiResponse.getStatus().equals("OK")) {
System.out.println("Replace Image in a PDF File using Image File, Done!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get text from particular fragment of pdf document
TextItemsResponse apiResponse = pdfApi.GetFragment(fileName, pageNumber, fragmentNumber, withEmpty, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for (TextItem textItem : apiResponse.getTextItems().getList())
{
System.out.println("Text:" + textItem.getText());
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get text items from pdf page
TextItemsResponse apiResponse = pdfApi.GetPageTextItems(fileName, pageNumber, withEmpty, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for(TextItem textItem : apiResponse.getTextItems().getList())
{
System.out.println("Text:" + textItem.getText());
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
String withEmpty = "";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get text items from pdf document
TextItemsResponse apiResponse = pdfApi.GetTextItems(fileName, withEmpty, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
for (TextItem textItem : apiResponse.getTextItems().getList())
{
System.out.println("Text:" + textItem.getText());
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int fragmentNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get segment count from a pdf fragment
TextItemsResponse apiResponse = pdfApi.GetFragments(fileName, fragmentNumber, withEmpty, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Fragment Count :" + apiResponse.getTextItems().getList().size());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get segment count from a pdf fragment
TextItemsResponse apiResponse = pdfApi.GetSegments(fileName, pageNumber, fragmentNumber, withEmpty, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Segment Count :" + apiResponse.getTextItems().getList().size());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get text format of pdf fragment
TextFormatResponse apiResponse = pdfApi.GetFragmentTextFormat(fileName, pageNumber, fragmentNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
TextFormat segTextFormat = apiResponse.getTextFormat();
System.out.println("Segment Font Name - " + segTextFormat.getFontName());
System.out.println("Segment Font Size - " + segTextFormat.getFontSize().floatValue());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "segments.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
int segmentNumber = 1;
String storage = "";
String folder = "";
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to get text format of particular segment
TextFormatResponse apiResponse = pdfApi.GetSegmentTextFormat(fileName, pageNumber, fragmentNumber, segmentNumber, storage, folder);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
TextFormat segTextFormat = apiResponse.getTextFormat();
System.out.println("Segment Font Name - " + segTextFormat.getFontName());
System.out.println("Segment Font Size - " + segTextFormat.getFontSize().floatValue());
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
TextReplace body = new TextReplace();
body.setOldValue ( "Sample PDF");
body.setNewValue ( "Sample Aspose PDF");
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace text in a pdf page
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceText(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Replace Text in a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
TextReplaceListRequest body = new TextReplaceListRequest();
TextReplace tr1 = new TextReplace();
tr1.setOldValue("Sample");
tr1.setNewValue("Aspose Sample");
TextReplace tr2 = new TextReplace();
tr2.setOldValue ( "PDF");
tr2.setNewValue ( "PDF Document");
TextReplace[] arr={ tr1, tr2 };
body.setTextReplaces ( new ArrayList<TextReplace> (Arrays.asList(arr)));
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace mutiple text in pdf page
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceTextList(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Replace Multiple Texts in a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
TextReplaceListRequest body = new TextReplaceListRequest();
TextReplace tr1 = new TextReplace();
tr1.setOldValue("Sample");
tr1.setNewValue("Aspose Sample");
TextReplace tr2 = new TextReplace();
tr2.setOldValue ( "PDF");
tr2.setNewValue ( "PDF Document");
TextReplace[] arr={ tr1, tr2 };
body.setTextReplaces ( new ArrayList<TextReplace> (Arrays.asList(arr)));
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace mutiple text in pdf page
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceTextList(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Replace Multiple Texts in a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
TextReplaceListRequest body = new TextReplaceListRequest();
TextReplace tr1 = new TextReplace();
tr1.setOldValue( "Sample");
tr1.setNewValue ( "Aspose Sample");
TextReplace tr2 = new TextReplace();
tr2.setOldValue ("PDF");
tr2.setNewValue ( "PDF Document");
TextReplace[] arr={ tr1, tr2 };
body.setTextReplaces ( new ArrayList<TextReplace> (Arrays.asList(arr)));
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace multiple text in PDF
DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceTextList(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Replace Multiple Texts in a PDF, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
TextReplace body = new TextReplace();
body.setOldValue ( "Sample PDF");
body.setNewValue ( "Sample Aspose PDF");
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to replace text in a pdf file
DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceText(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.getStatus().equals("OK"))
{
System.out.println("Replace Text in a PDF File, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
String imageFile = "aspose-cloud.png";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.setFileName ( imageFile);
body.setBackground ( true);
body.setType ( "Image");
body.setPageIndex ( 0);
body.setLeftMargin ( 0.0);
body.setOpacity ( 0.5);
body.setRightMargin ( 0.0);
body.setTopMargin ( 0.0);
body.setYIndent ( 100.0);
body.setXIndent ( 100.0);
body.setZoom ( 1.0);
body.setTextState ( null);
body.setWidth ( 300.0);
body.setHeight ( 300.0);
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
Path inputImage = Utils.getPath(ExtractImageDefaultSizeExample.class, imageFile);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "",inputFile.toFile());
storageApi.PutCreate(imageFile, "", "", inputImage.toFile());
// Invoke Aspose.PDF Cloud SDK API to add image stamp to a pdf page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null)
{
System.out.println("Add Image Stamp (Watermark) to a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.setFileName ( fileName);
body.setBackground ( true);
body.setType ( "Image");
body.setPageIndex ( 0);
body.setLeftMargin ( 0.0);
body.setOpacity ( 0.5);
body.setRightMargin ( 0.0);
body.setTopMargin ( 0.0);
body.setYIndent ( 100.0);
body.setXIndent ( 100.0);
body.setZoom ( 1.0);
body.setTextState ( null);
body.setWidth ( 300.0);
body.setHeight ( 300.0);
Path inputFile = Utils.getPath(AddPageNumberToPDFPageExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to add page number stamp to a pdf page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null)
{
System.out.println("Add Page Number Stamp to a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
// For complete examples and data files, please go to
// https://github.com/aspose-tasks/Aspose.Tasks-for-Java
String fileName = "sample-input.pdf";
String pdfName = "Sample.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.setFileName(pdfName);
body.setBackground(true);
body.setType("Image");
body.setPageIndex(0);
body.setLeftMargin(0.0);
body.setOpacity(0.5);
Path inputPDF = Utils.getPath(GetAllBookmarksExample.class, fileName);
Path inputFile = Utils.getPath(GetAllBookmarksExample.class, fileName);
try {
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
storageApi.PutCreate(pdfName, "", "", inputPDF.toFile());
// Invoke Aspose.PDF Cloud SDK API to add pdf page as stamp to a pdf
// page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null) {
System.out.println("Add PDF Page as Stamp (Watermark) to a PDF Page, Done!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-Cloud
String fileName = "sample-input.pdf";
String pdfName = "Sample.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.setFileName ( pdfName);
body.setBackground ( true);
body.setType ( "Image");
body.setPageIndex ( 0);
body.setLeftMargin ( 0.0);
body.setOpacity ( 0.5);
body.setRightMargin ( 0.0);
body.setTopMargin ( 0.0);
body.setYIndent ( 100.0);
body.setXIndent ( 100.0);
body.setZoom ( 1.0);
body.setTextState ( null);
body.setWidth ( 300.0);
body.setHeight ( 300.0);
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
Path inputPDF = Utils.getPath(ExtractImageDefaultSizeExample.class, pdfName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
storageApi.PutCreate(pdfName, "", "", inputPDF.toFile());
// Invoke Aspose.PDF Cloud SDK API to add pdf page as stamp to a pdf page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null)
{
System.out.println("Add PDF Page as Stamp (Watermark) to a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.setValue ("Aspose.com");
body.setBackground ( true);
body.setType ("Text");
Path inputFile = Utils.getPath(ExtractImageDefaultSizeExample.class, fileName);
try
{
StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);
// Instantiate Aspose Words API SDK
PdfApi pdfApi = new PdfApi(Configuration.apiKey, Configuration.appSID, true);
// Upload source file to aspose cloud storage
storageApi.PutCreate(fileName, "", "", inputFile.toFile());
// Invoke Aspose.PDF Cloud SDK API to add text stamp to a pdf page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null)
{
System.out.println("Add Text Stamp (Watermark) to a PDF Page, Done!");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment