Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active January 25, 2021 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/8c0678437a10062f840ba17f5a719535 to your computer and use it in GitHub Desktop.
Save aspose-cloud/8c0678437a10062f840ba17f5a719535 to your computer and use it in GitHub Desktop.
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
const string clientID = "xxxxxx-1c8e-4ea4-a948-3857547232fa";
const string clientSecret = "xxxxxx613237f013e329cdf5694cc96a";
Aspose.Pdf.Cloud.Sdk.Api.PdfApi pdfApi = new Aspose.Pdf.Cloud.Sdk.Api.PdfApi(clientSecret, clientID);
String fileName = "FormDataTextBox.pdf";
try
{
// Invoke Aspose.PDF Cloud SDK API to get all fields from pdf document
Aspose.Pdf.Cloud.Sdk.Model.FieldsResponse apiResponse = pdfApi.GetFields(fileName, null, null);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
foreach (Aspose.Pdf.Cloud.Sdk.Model.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 e)
{
Console.WriteLine("Exception while calling Api: " + e.ToString());
}
// 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 = "";
TextReplaceListRequest body = new TextReplaceListRequest();
TextReplace tr1 = new TextReplace();
tr1.OldValue = "Sample";
tr1.NewValue = "Aspose Sample";
TextReplace tr2 = new TextReplace();
tr2.OldValue = "PDF";
tr2.NewValue = "PDF Document";
body.TextReplaces = new List<TextReplace> { tr1, tr2 };
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 mutiple text in pdf page
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceTextList(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace Multiple Texts in 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 = "sample-input.pdf";
String storage = "";
String folder = "";
TextReplaceListRequest body = new TextReplaceListRequest();
TextReplace tr1 = new TextReplace();
tr1.OldValue = "Sample";
tr1.NewValue = "Aspose Sample";
TextReplace tr2 = new TextReplace();
tr2.OldValue = "PDF";
tr2.NewValue = "PDF Document";
body.TextReplaces = new List<TextReplace> { tr1, tr2 };
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 multiple text in PDF
DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceTextList(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace Multiple Texts 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 = "sample-input.pdf";
String storage = "";
String folder = "";
TextReplace body = new TextReplace();
body.OldValue = "Sample PDF";
body.NewValue = "Sample Aspose PDF";
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 text in a pdf file
DocumentTextReplaceResponse apiResponse = pdfApi.PostDocumentReplaceText(fileName, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace Text 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 = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
TextReplace body = new TextReplace();
body.OldValue = "Sample PDF";
body.NewValue = "Sample Aspose PDF";
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 text in a pdf page
PageTextReplaceResponse apiResponse = pdfApi.PostPageReplaceText(fileName, pageNumber, storage, folder, body);
if (apiResponse != null && apiResponse.Status.Equals("OK"))
{
Console.WriteLine("Replace Text in 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-cloud/aspose-pdf-cloud-dotnet
PdfApi pdfApi = new PdfApi("API_KEY", "APP_SID");
string Name = "MyNewFile.pdf";
try {
var response = api.PutAddText(Name, 1, PutAddTextExample());
Console.WriteLine(response);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
}
public static Aspose.Pdf.Cloud.Sdk.Model.Paragraph PutAddTextExample()
{
//ExStart: PutAddTextExample
Aspose.Pdf.Cloud.Sdk.Model.Paragraph paragraph = new Aspose.Pdf.Cloud.Sdk.Model.Paragraph(
Rectangle: new Aspose.Pdf.Cloud.Sdk.Model.Rectangle(100, 600, 300, 800),
LeftMargin: 10,
RightMargin: 10,
TopMargin: 10,
BottomMargin: 10,
HorizontalAlignment: Aspose.Pdf.Cloud.Sdk.Model.TextHorizontalAlignment.FullJustify,
LineSpacing: Aspose.Pdf.Cloud.Sdk.Model.LineSpacing.FontSize,
Rotation: 10,
SubsequentLinesIndent: 10,
VerticalAlignment: Aspose.Pdf.Cloud.Sdk.Model.VerticalAlignment.Center,
WrapMode: Aspose.Pdf.Cloud.Sdk.Model.WrapMode.ByWords,
Lines: new System.Collections.Generic.List<Aspose.Pdf.Cloud.Sdk.Model.TextLine>
{
new Aspose.Pdf.Cloud.Sdk.Model.TextLine(
HorizontalAlignment: Aspose.Pdf.Cloud.Sdk.Model.TextHorizontalAlignment.Right,
Segments: new System.Collections.Generic.List<Aspose.Pdf.Cloud.Sdk.Model.Segment>
{
new Aspose.Pdf.Cloud.Sdk.Model.Segment(
Value: "Aspose.PDF Cloud API",
TextState: new Aspose.Pdf.Cloud.Sdk.Model.TextState(
Font: "Arial",
FontSize: 16,
ForegroundColor: new Aspose.Pdf.Cloud.Sdk.Model.Color(0x00, 0x33, 0x33, 0x99),
// BackgroundColor: new Aspose.Pdf.Cloud.Sdk.Model.Color(0x00, 0xCC, 0xFF, 0xCC),
FontStyle: Aspose.Pdf.Cloud.Sdk.Model.FontStyles.BoldItalic, FontFile: "Allura-Regular.otf"
)
)
}
)
}
);
return paragraph;
}
// 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 imageFile = "aspose-cloud.png";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.FileName = imageFile;
body.Background = true;
body.Type = "Image";
body.PageIndex = 0;
body.LeftMargin = 0.0;
body.Opacity = 0.5;
body.RightMargin = 0.0;
body.TopMargin = 0.0;
body.YIndent = 100.0;
body.XIndent = 100.0;
body.Zoom = 1.0;
body.TextState = null;
body.Width = 300.0;
body.Height = 300.0;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
pdfApi.UploadFile(imageFile, System.IO.File.ReadAllBytes(Common.GetDataDir() + imageFile));
// 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)
{
Console.WriteLine("Add Image Stamp (Watermark) to 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 = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.Background = true;
body.Value = "Page # of 2";
body.Type = "PageNumber";
body.PageIndex = 0;
body.LeftMargin = 0.0;
body.Opacity = 0.5;
body.RightMargin = 0.0;
body.TopMargin = 0.0;
body.YIndent = 100.0;
body.XIndent = 100.0;
body.Zoom = 1.0;
body.TextState = null;
body.Width = 300.0;
body.Height = 300.0;
body.StartingNumber = 1;
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 page number stamp to a pdf page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null)
{
Console.WriteLine("Add Page Number Stamp to 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 = "sample-input.pdf";
String pdfName = "Sample.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.FileName = pdfName;
body.Background = true;
body.Type = "Image";
body.PageIndex = 0;
body.LeftMargin = 0.0;
body.Opacity = 0.5;
body.RightMargin = 0.0;
body.TopMargin = 0.0;
body.YIndent = 100.0;
body.XIndent = 100.0;
body.Zoom = 1.0;
body.TextState = null;
body.Width = 300.0;
body.Height = 300.0;
try
{
// Upload source file to aspose cloud storage
pdfApi.UploadFile(fileName, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
pdfApi.UploadFile(pdfName, System.IO.File.ReadAllBytes(Common.GetDataDir() + pdfName));
// 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)
{
Console.WriteLine("Add PDF Page as Stamp (Watermark) to 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 = "sample-input.pdf";
int pageNumber = 1;
String storage = "";
String folder = "";
Stamp body = new Stamp();
body.Value = "Aspose.com";
body.Background = true;
body.Type = "Text";
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 text stamp to a pdf page
SaaSposeResponse apiResponse = pdfApi.PutPageAddStamp(fileName, pageNumber, storage, folder, body);
if (apiResponse != null)
{
Console.WriteLine("Add Text Stamp (Watermark) to a PDF Page, Done!");
Console.ReadKey();
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment