Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Aspose.PDF-Cloud-SDK-DOTNET
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
foreach (Link annotatonLink in apiResponse.Annotations.Links)
{
Console.WriteLine("Annotation Link :: " + annotatonLink.Href);
}
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
int count = apiResponse.Annotations.Links.Count;
Console.WriteLine("Annotation Count :: " + count);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
int pageNumber = 1;
int annotationNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
Annotation annotation = apiResponse.Annotation;
Console.WriteLine("Annotation Content" + annotation.Contents);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "SampleAttachment";
String fileName = name + ".pdf";
int attachmentIndex = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to download specific attachment from a pdf
ResponseMessage apiResponse = pdfApi.GetDownloadDocumentAttachmentByIndex(fileName, attachmentIndex, storage, folder);
if (apiResponse != null)
{
Console.WriteLine("Download a specific Attachment from a PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "SampleAttachment.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get all attachments from a pdf
AttachmentsResponse apiResponse = pdfApi.GetDocumentAttachments(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Get all Attachments from a PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "SampleAttachment.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get attachment count from a pdf
AttachmentsResponse apiResponse = pdfApi.GetDocumentAttachments(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Com.Aspose.PDF.Model.Attachments attachments = apiResponse.Attachments;
int count = attachments.List.Count;
Console.WriteLine("Count :: " + count);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "SampleAttachment";
String fileName = name + ".pdf";
int attachmentIndex = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
Attachment attach = apiResponse.Attachment;
Console.WriteLine("Name :: " + attach.Name);
Console.WriteLine("MimeType :: " + attach.MimeType);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Bookmark.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get all bookmarks from pdf
BookmarksResponse apiResponse = pdfApi.GetDocumentBookmarks(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Com.Aspose.PDF.Model.Bookmarks bookmarks = apiResponse.Bookmarks;
Console.WriteLine("Get all Bookmarks from a PDF,Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Bookmark.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get bookmark count from pdf
BookmarksResponse apiResponse = pdfApi.GetDocumentBookmarks(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Com.Aspose.PDF.Model.Bookmarks bookmarks = apiResponse.Bookmarks;
int count = bookmarks.List.Count;
Console.WriteLine("Bookmark Count :: " + count);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "Sample-Bookmark.pdf";
string bookmarkPath = null;
string storage = null;
string folder = null;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get bookmarks children
ResponseMessage apiResponse = pdfApi.GetDocumentBookmarksChildren(fileName, bookmarkPath, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Get Bookmarks Children from a PDF,Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Bookmark.pdf";
String bookmarkPath = "1";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get specific bookmark
ResponseMessage apiResponse = pdfApi.GetDocumentBookmarksChildren(fileName, bookmarkPath, storage, folder);
if (apiResponse != null)
{
Console.WriteLine("Get Specific Bookmark from a PDF,Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
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.Document = appendFileName;
body.StartPage = 2;
body.EndPage = 3;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
pdfApi.UploadFile(appendFileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + appendFileName));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Append PDF Files, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample.pdf";
String format = "html";
String storage = "";
String folder = "";
String outPath = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to convert pdf to images
ResponseMessage apiResponse = pdfApi.GetDocumentWithFormat(fileName, format, storage, folder, "outFile");
if (apiResponse != null)
{
Console.WriteLine("Convert PDF to TIFF, Done!");
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
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 = "";
byte[] file = null; //System.IO.File.ReadAllBytes("\\temp\\pdf\\resources\\" + fileName);
try
{
ResponseMessage apiResponse = pdfApi.PutConvertDocument(format, url, outPath, file);
if (apiResponse != null)
{
Console.WriteLine("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, file);
if (apiResponse != null)
{
Console.WriteLine("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, file);
if (apiResponse != null)
{
Console.WriteLine("Convert PDF from Remote Server to HTML, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("ERROR:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample.pdf";
String format = "html";
String url = "";
String outPath = "";
byte[] file = System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName);
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to convert pdf to other formats
ResponseMessage apiResponse = pdfApi.PutConvertDocument(format, url, outPath, file);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "input.pdf";
String templateFile = "";
String dataFile = "";
String templateType = "";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Create Empty PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-dotnet
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample.pdf";
String templateFile = "Sample.html";
String dataFile = "";
String templateType = "html";
String storage = "";
String folder = "";
try
{
// Upload source files to aspose cloud storage
pdfApi.UploadFile(templateFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + templateFile));
// 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.Status.Equals("OK"))
{
// Download created pdf file
Stream storageRes = pdfApi.DownloadFile(fileName);
// Save response stream to a file
storageRes.CopyTo(new FileStream(Common.GetDataDir() + "Sample_out.pdf", FileMode.Create));
Console.WriteLine("Create PDF from HTML, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "input_out.pdf";
String templateFile = "sample.xsl";
String dataFile = "sample.xml";
String templateType = "xml";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(templateFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + templateFile));
pdfApi.UploadFile(dataFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + dataFile));
// 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.Status.Equals("OK"))
{
// Download created pdf file
Stream storageRes = pdfApi.DownloadFile(fileName);
// Save response stream to a file
storageRes.CopyTo(new FileStream(Common.GetDataDir() + "Sample_out.pdf", FileMode.Create));
Console.WriteLine("Create PDF from XML, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-jpeg.pdf";
String templateFile = "Einstein_JPEG.jpg";
String dataFile = "";
String templateType = "jpeg";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(templateFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + templateFile));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Create PDF from JPEG, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-svg.pdf";
String templateFile = "Sample.epub";
String dataFile = "";
String templateType = "epub";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(templateFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + templateFile));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Create PDF from SVG, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-tiff.pdf";
String templateFile = "Sample.tiff";
String dataFile = "";
String templateType = "tiff";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(templateFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + templateFile));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Create PDF from TIFF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-merged.pdf";
String storage = "";
String folder = "";
MergeDocuments body = new MergeDocuments();
body.List = new System.Collections.Generic.List<string> { "sample.pdf", "input.pdf" };
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile("sample.pdf", System.IO.File.ReadAllBytes(Common.GetDataDir() + "sample.pdf"));
pdfApi.UploadFile("input.pdf", System.IO.File.ReadAllBytes(Common.GetDataDir() + "input.pdf"));
// Invoke Aspose.PDF Cloud SDK API to merge pdf files
DocumentResponse apiResponse = pdfApi.PutMergeDocuments(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Merge Multiple PDF Files, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get all document properies
DocumentPropertiesResponse apiResponse = pdfApi.GetDocumentProperties(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
foreach (DocumentProperty docProp in apiResponse.DocumentProperties.List)
{
Console.WriteLine(docProp.Name + " :: " + docProp.Value);
}
Console.WriteLine("Get All Document Properties from a PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
String propertyName = "Creator";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get particular document property
DocumentPropertyResponse apiResponse = pdfApi.GetDocumentProperty(fileName, propertyName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
DocumentProperty docProp = apiResponse.DocumentProperty;
Console.WriteLine(docProp.Name + " :: " + docProp.Value);
Console.WriteLine("Get a Particular Document Property from a PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to remove all document properties
SaaSposeResponse apiResponse = pdfApi.DeleteProperties(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Remove All Document Properties from a PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "Sample-Annotation.pdf";
String propertyName = "author";
String storage = "";
String folder = "";
DocumentProperty body = new DocumentProperty();
body.Name = "author";
body.Value = "Naeem Akram";
body.BuiltIn = true;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
DocumentProperty docProp = apiResponse.DocumentProperty;
Console.WriteLine(docProp.Name + " :: " + docProp.Value);
Console.WriteLine("Set a Single Document Property in a PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "test.pdf";
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.TextReplace body = new Com.Aspose.PDF.Model.TextReplace();
body.OldValue = "Sample PDF";
body.NewValue = "This is the new test added by IA";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile( fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to replace pdf text
DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceText(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace PDF Document Text, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "test.pdf";
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.TextReplaceListRequest body = new Com.Aspose.PDF.Model.TextReplaceListRequest();
Com.Aspose.PDF.Model.TextReplace tr = new Com.Aspose.PDF.Model.TextReplace();
tr.NewValue = "This will be the new text";
body.TextReplaces = new System.Collections.Generic.List<Com.Aspose.PDF.Model.TextReplace> { tr };
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile( fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to replace pdf text list
DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceTextList(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace PDF Document Text List, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input-2.pdf";
String signatureFileName = "pkc7-sample.pfx";
String storage = "";
String folder = "";
Signature body = new Signature();
body.Authority = "Farooq Sheikh";
body.Location = "Gojra";
body.Contact = "naeem.akram@aspose.com";
body.Date = "06/20/2017 2:00:00.000 AM";
body.FormFieldName = "Signature1";
body.Password = "aspose";
Rectangle rect = new Rectangle();
rect.X = 100;
rect.Y = 100;
rect.Height = 100;
rect.Width = 200;
body.Rectangle = rect;
body.SignaturePath = signatureFileName;
body.SignatureType = "PKCS7";
body.Visible = true;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
pdfApi.UploadFile(signatureFileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + signatureFileName));
// Invoke Aspose.PDF Cloud SDK API to sign Pdf document
SaaSposeResponse apiResponse = pdfApi.PostSignDocument(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
// Download created pdf file
Stream storageRes = pdfApi.DownloadFile(fileName);
// Save response stream to a file
storageRes.CopyTo(new FileStream(Common.GetDataDir() + "Sample_out.pdf", FileMode.Create));
Console.WriteLine("Sign PDF Documents, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "input.pdf";
String format = "pdf";
int from = 1;
int to = 2;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to split pdf files
SplitResultResponse apiResponse = pdfApi.PostSplitDocument(fileName, format, from, to, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Split PDF Files, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "test.pdf";
int? page = 1;
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.Field body = new Com.Aspose.PDF.Model.Field();
Com.Aspose.PDF.Model.Link link = new Com.Aspose.PDF.Model.Link();
link.Href = "http://api.aspose.cloud/v1.1/pdf/ABFillablewfields.pdf/fields/NewField";
link.Rel = "self";
link.Title = "NewField";
link.Type = "link";
Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle();
rect.X = 0;
rect.Y = 0;
body.Name = "dvDate_1";
body.Values = new System.Collections.Generic.List<string> { "NewFieldValue" };
body.Rect = rect;
body.SelectedItems = new System.Collections.Generic.List<int?> { 1 };
body.Type = 0;
body.Links = new System.Collections.Generic.List<Com.Aspose.PDF.Model.Link> { link };
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to create form field
SaaSposeResponse apiResponse = pdfApi.PostCreateField(fileName, page, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Create a Form Field in a PDF Document, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "test.pdf";
int? page = 1;
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.Field body = new Com.Aspose.PDF.Model.Field();
Com.Aspose.PDF.Model.Link link = new Com.Aspose.PDF.Model.Link();
link.Href = "http://api.aspose.cloud/v1.1/pdf/ABFillablewfields.pdf/fields/NewField";
link.Rel = "self";
Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle();
rect.X = 100;
rect.Y = 100;
body.Rect = rect;
body.Name = "Signature1";
body.Values = new System.Collections.Generic.List<string> { ""};
body.Type = 0;
body.Links = new System.Collections.Generic.List<Com.Aspose.PDF.Model.Link> { link };
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to create form field
SaaSposeResponse apiResponse = pdfApi.PostCreateField(fileName, page, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
// Download created pdf file
Stream storageRes = pdfApi.DownloadFile(fileName);
// Save response stream to a file
storageRes.CopyTo(new FileStream(Common.GetDataDir() + "Sample_out.pdf", FileMode.Create));
Console.WriteLine("Create a Form Field in a PDF Document, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input-2.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get all fields from pdf document
FieldsResponse apiResponse = pdfApi.GetFields(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
foreach (Field field in apiResponse.Fields.List)
{
Console.WriteLine("Name: " + field.Name + "Type: " + field.Type);
}
Console.WriteLine("Get all Form Fields from the PDF Document, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-field.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get field count
FieldsResponse apiResponse = pdfApi.GetFields(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
int count = apiResponse.Fields.List.Count;
Console.WriteLine("Count" + count);
Console.WriteLine("Get Form Field Count from a PDF Document, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-field.pdf";
String fieldName = "textbox1";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get particular field
FieldResponse apiResponse = pdfApi.GetField(fileName, fieldName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Field field = apiResponse.Field;
Console.WriteLine("Name" + field.Name);
Console.WriteLine("Value" + field.Values[0]);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-field.pdf";
String fieldName = "textbox1";
String storage = "";
String folder = "";
Field body = new Field();
body.Name = "textbox1";
body.Values = new List<string> { "Aspose" };
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to update form field
FieldResponse apiResponse = pdfApi.PutUpdateField(fileName, storage, folder, fieldName, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Field field = apiResponse.Field;
Console.WriteLine("Name" + field.Name);
Console.WriteLine("Value" + field.Values[0]);
Console.WriteLine("Update a Form Field in a PDF Document, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-dotnet
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String imageName = "SampleImage.jpg";
String fileName = "PDFWithImages.pdf";
int pageNumber = 1;
double llx = 10.0;
double lly = 10.0;
double urx = 100.0;
double ury = 100.0;
String storage = "First Storage";
String folder = "temp_folder_path";
String imageFilePath = Path.Combine(folder, imageName);
byte[] file = System.IO.File.ReadAllBytes("DATA_DIR_PATH" + imageName);
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName,File.Open("..\\..\\..\\Resources\\" + imageName, FileMode.Open), storage);
// Invoke Aspose.PDF Cloud SDK API to replace image using image file
var response = pdfApi.PostInsertImage(fileName, pageNumber, llx, lly, urx, ury, imageFilePath, folder);
if (response != null && response.Status.Equals("OK"))
{
Console.WriteLine("Added new image to PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String format = "jpeg";
int? width = null;
int? height = null;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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)
{
Console.WriteLine("Extract a Particular Image from a PDF Page with Default Size, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
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 = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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)
{
Console.WriteLine("Extract a Particular Image from a PDF Page with Specified Size, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "SampleImage.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get image count
ImagesResponse apiResponse = pdfApi.GetImages(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
int count = apiResponse.Images.List.Count;
Console.WriteLine("Image Count " + count);
Console.WriteLine("Get Image Count from a PDF Page, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "Lenovo_Tablet_2_Datasheet.pdf";
int? pageNumber = 1;
int? imageNumber = 1;
string format = "jpeg";
int? width = 0;
int? height = 0;
string storage = null;
string folder = null;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get image with format
ResponseMessage apiResponse = pdfApi.GetImageWithFormat(fileName, pageNumber, imageNumber, format, width, height, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("Ok"))
{
Console.WriteLine("Get Image with Format, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String imageFile = "aspose-cloud.png";
String storage = "";
String folder = "";
byte[] file = System.IO.File.ReadAllBytes(Common.GetDataDir() + imageFile);
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to replace image using image file
ImageResponse apiResponse = pdfApi.PostReplaceImage(fileName, pageNumber, imageNumber, imageFile, storage, folder, file);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace Image in a PDF File using Image File, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "SampleImage";
String fileName = name + ".pdf";
int pageNumber = 1;
int imageNumber = 1;
String imageFile = "aspose-cloud.png";
String storage = "";
String folder = "";
byte[] file = System.IO.File.ReadAllBytes(Common.GetDataDir() + imageFile);
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to replace image using local image stream
ImageResponse apiResponse = pdfApi.PostReplaceImage(fileName, pageNumber, imageNumber, imageFile, storage, folder, file);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace Image in a PDF file using Local Image Stream, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to add new page
DocumentPagesResponse apiResponse = pdfApi.PutAddNewPage(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Add a New Page in PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "sample-input";
String fileName = name + ".pdf";
int pageNumber = 1;
String format = "jpeg";
int? width = null;
int? height = null;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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)
{
Console.WriteLine("Convert a PDF Page to Image with Default Size, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String name = "sample-input";
String fileName = name + ".pdf";
int pageNumber = 1;
String format = "jpeg";
int width = 300;
int height = 300;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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)
{
Console.WriteLine("Convert a PDF Page to Image with Specified Size, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to delete page from Pdf
SaaSposeResponse apiResponse = pdfApi.DeletePage(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Delete Page from PDF, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get page count from pdf document
DocumentPagesResponse apiResponse = pdfApi.GetPages(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
int count = apiResponse.Pages.List.Count;
Console.WriteLine("Total Page Count :: " + count);
Console.WriteLine("Get PDF Document Page Count, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int? pageNumber = 1;
string storage = null;
string folder = null;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get page informations
ResponseMessage apiResponse = pdfApi.GetPage(fileName, pageNumber, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("Ok"))
{
Console.WriteLine("Get PDF Document Page, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get words count per page from pdf document
WordCountResponse apiResponse = pdfApi.GetWordsPerPage(fileName, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
foreach (PageWordCount PageWordCount in apiResponse.WordsPerPage.List)
{
Console.WriteLine("Page Number :: " + PageWordCount.PageNumber + " Total Words :: " + PageWordCount.Count);
}
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-merged.pdf";
int pageNumber = 1;
int newIndex = 2;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Move PDF Pages to New Locations in a PDF File, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "test.pdf";
int? pageNumber = 1;
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.TextReplace body = new Com.Aspose.PDF.Model.TextReplace();
body.NewValue = "This is the latest text added by IA";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to replace pdf document page text
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceText(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("PDF Document Page Replace Text, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "test.pdf";
int? pageNumber = 1;
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.TextReplaceListRequest body = new Com.Aspose.PDF.Model.TextReplaceListRequest();
Com.Aspose.PDF.Model.TextReplace tr = new Com.Aspose.PDF.Model.TextReplace();
tr.NewValue = "This will be the new text";
body.TextReplaces = new System.Collections.Generic.List<Com.Aspose.PDF.Model.TextReplace> { tr };
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to replace pdf document page text list
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceTextList(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("PDF Document Page Replace Text List, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string fileName = "sample-input.pdf";
int? pageNumber = 1;
string storage = null;
string folder = null;
Com.Aspose.PDF.Model.Signature body = new Com.Aspose.PDF.Model.Signature();
body.Authority = "Authority";
body.Contact = "naeem.akram@aspose.com";
body.Date = "18-4-2016";
body.FormFieldName = "Signature1";
body.Location = "Gojra";
body.Password = "aspose";
Com.Aspose.PDF.Model.Rectangle rect = new Com.Aspose.PDF.Model.Rectangle();
rect.X = 100;
rect.Y = 100;
rect.Height = 100;
rect.Width = 200;
body.Rectangle = rect;
body.SignaturePath = "pkc7-sample.pfx";
body.SignatureType = "PKCS7";
body.Visible = true;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
pdfApi.UploadFile(body.SignaturePath, System.IO.File.ReadAllBytes(Common.GetDataDir() + body.SignaturePath));
// Invoke Aspose.PDF Cloud SDK API to sign pdf page
SaaSposeResponse apiResponse = pdfApi.PostSignPage(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("Ok"))
{
Console.WriteLine("Sign PDF Document Page, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int pageNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// Invoke Aspose.PDF Cloud SDK API to get fragment count from a pdf page
TextItemsResponse apiResponse = pdfApi.GetFragments(fileName, pageNumber, withEmpty, storage, folder);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Fragment Count :" + apiResponse.TextItems.List.Count);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
Console.WriteLine("Fragment Count :" + apiResponse.TextItems.List.Count);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
TextFormat segTextFormat = apiResponse.TextFormat;
Console.WriteLine("Segment Font Name - " + segTextFormat.FontName);
Console.WriteLine("Segment Font Size - " + segTextFormat.FontSize.Value);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "segments.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
int segmentNumber = 1;
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
TextFormat segTextFormat = apiResponse.TextFormat;
Console.WriteLine("Segment Font Name - " + segTextFormat.FontName);
Console.WriteLine("Segment Font Size - " + segTextFormat.FontSize.Value);
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
String withEmpty = "";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
foreach (TextItem textItem in apiResponse.TextItems.List)
{
Console.WriteLine("Text:" + textItem.Text);
}
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");;
String fileName = "sample-input.pdf";
int pageNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
foreach (TextItem textItem in apiResponse.TextItems.List)
{
Console.WriteLine("Text:" + textItem.Text);
}
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int pageNumber = 1;
int fragmentNumber = 1;
String withEmpty = "";
String storage = "";
String folder = "";
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
// 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.Status.Equals("OK"))
{
foreach (TextItem textItem in apiResponse.TextItems.List)
{
Console.WriteLine("Text:" + textItem.Text);
}
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-dotnet
Aspose.Pdf.Cloud.Sdk.Api.PdfApi api = new Aspose.Pdf.Cloud.Sdk.Api.PdfApi("API_KEY", "APP_SID");
public static void PostPageTextReplaceExample()
{
//ExStart: PostPageTextReplaceExample
var rect = new Aspose.Pdf.Cloud.Sdk.Model.Rectangle(100, 600, 300, 800);
var textState = new Aspose.Pdf.Cloud.Sdk.Model.TextState(
FontSize: 14, ForegroundColor: new Aspose.Pdf.Cloud.Sdk.Model.Color(
0x00, 0x33, 0x13, 0x49), FontFile: "KaushanScript-Regular.otf");
var textReplace = new Aspose.Pdf.Cloud.Sdk.Model.TextReplace("API", "SDK", true, TextState: textState , Rect: rect);
var textReplaceList = new Aspose.Pdf.Cloud.Sdk.Model.TextReplaceListRequest(
new System.Collections.Generic.List<Aspose.Pdf.Cloud.Sdk.Model.TextReplace> { textReplace },
StartIndex: 0, CountReplace: 1);
Aspose.Pdf.Cloud.Sdk.Api.PdfApi api = new Aspose.Pdf.Cloud.Sdk.Api.PdfApi("15fa9268fd293c7998a5051c88a75f80", "265ae48d-aa27-4470-9e84-3e383050a436");
var response = api.PostPageTextReplace("MyNewFile.pdf", 1, textReplaceList);
Console.WriteLine(response);
//ExEnd: PostPageTextReplaceExample
}
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
String fileName = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";