I have a web API which receives multiple files which are images. At the moment I save the image in my local disk and then perform methods on it. And then upload the local copy of it to Azure storage. What I want to be able to do is -
1) Get the image directly (if possible and then perform methods)
2) Save the pdf directly to Azure storage.
My code looks like this.
public static class Imageupload
{
[FunctionName("Imageupload")]
public static async System.Threading.Tasks.Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "HttpTriggerCSharp/name/{name}")]HttpRequestMessage req, string name, TraceWriter log)
{
//Check if the request contains multipart/form-data.
if (!req.Content.IsMimeMultipartContent())
{
return req.CreateResponse(HttpStatusCode.UnsupportedMediaType);
}
var storageConnectionString = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
var storageAccount = CloudStorageAccount.Parse(storageConnectionString);
log.Info(storageConnectionString);
var blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference("temporary-images");
// Create the container if it doesn't already exist.
container.CreateIfNotExists();
//Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("images");
//The root path where the content of MIME multipart body parts are written to
var provider = new MultipartFormDataStreamProvider(#"C:\Users\Al\Desktop\Images\");
var s = blockBlob.Uri.AbsoluteUri;
await req.Content.ReadAsMultipartAsync();
//Test function for aspose
// Instantiate Document object
var pdf = new Aspose.Pdf.Document();
//Add a page to the document
var pdfImageSection = pdf.Pages.Add();
List<UploadedFileInfo> files = new List<UploadedFileInfo>();
// This illustrates how to get the file names.
foreach (MultipartFileData file in provider.FileData)
{
var fileInfo = new FileInfo(file.Headers.ContentDisposition.FileName.Trim('"'));
files.Add(new UploadedFileInfo()
{
FileName = fileInfo.Name,
ContentType = file.Headers.ContentType.MediaType,
FileExtension = fileInfo.Extension,
FileURL = file.LocalFileName
});
//Iterate through multiple images
FileStream stream = new FileStream(file.LocalFileName, FileMode.Open);
System.Drawing.Image img = new System.Drawing.Bitmap(stream);
var image = new Aspose.Pdf.Image { ImageStream = stream };
//Set appearance properties
image.FixHeight = 300;
image.FixWidth = 300;
//Set margins for proper spacing and alignment
image.Margin = new MarginInfo(5, 10, 5, 10);
//Add the image to paragraphs of the document
pdfImageSection.Paragraphs.Add(image);
}
//Save resultant document
pdf.Save(#"C:\Users\Al\Desktop\Images\Image2Pdf_out.pdf");
var ss = pdf.FileName;
blockBlob.UploadFromFile(#"C:\Users\Al\Desktop\Images\Image2Pdf_out.pdf");
return req.CreateResponse(HttpStatusCode.OK, files, "application /json");
//return req.CreateResponse(HttpStatusCode.OK,"Its working","application/json");
}
Now this works when I am saving this in my local disk and upload to Azure. But saving it in local disk wont work after I publish the function to Azure portal.
So I want to get the images, and then add them into a PDF and upload to Azure storage. How can I do this?
Related
I am trying to upload a signature captured from a signature plugin (https://github.com/szimek/signature_pad). I am able to upload the image successfully to azure storage but the image is blank when I download it from Azure storage. Here is my code
var encodedImage = proposalModel.CustomTermsSignatureData.Split(',')[1];
var decodedImage = Convert.FromBase64String(encodedImage);
var ContentType = "image/png";
using (var FileStream = new MemoryStream(decodedImage))
{
await StorageManager.UploadFile(FileStream, ContentType, proposal.EnquiryId + "/" + proposal.VenueId + "/" + "0.png", "enquiryvenuesignatures");
}
The upload file method works fine as it has been used throughout my code and uploads images and files perfectly. Could this be an issue with the plugin? Thanks in advance
Plz upload file to blob with blobClient.UploadAsync() method, refer to here.
var customTermsSignatureData = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdgAAAFoCAIAAAB7cX27AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAEXRFWHRTb2Z0d2FyZQBTbmlwYXN0ZV0Xzt0AACAASURBVHic7b3Lruw6sq73B5Vz1b4dN9ww3DBgw4D7bvmV/VLuGDiAGz6wt3FqV9WaI8VwgxfxKpFK3TO+WpUzh1IiKYoKBoPBIOF//xu2g7jvfGbqOl+xrv0SJ+vLoQEQUemnArXSEJG5cO5yVpUfwuNT+edLMl+eahF03xVDy33141Ojap3UqD3fGsrnpXjK2jzxvDXWmlv19jvLn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g+krOQNdQXORM2UjpHUsR64jxm6acbxIEEcROkEwinIm691vlpc2s+5trXxisS22lab4DrojrqLdaQ1o2HdtZWJEazEIFAiW33kX6v8Wv8HIkqXwwHgMRiRg9wCvBWuJZlUXfZmK+WSNZODBHGygvA6sYlFKz8Fqfa7s/ETrJpuUlNYaHMIpZkTvvZ7JLUj5zPnIORMJfPi+LCGepRpQutI+fXGYnkhL0NNFw51gMxCJggJQXthlb7gbpkZJTKuIgc0a+JY+IZiJNd8g8CSUcoq12R5Zpxi9lo+crx7eDximqJgXMHH8wpl+ELEj/vufP7iRCnU4lO7FRZ5gzGz4OH6NzCHwYBSLTg5zgwXiKi1kHtylCDOK0IkoCD041W7u62dK8xZOQtlVQ7EU0uBtUEzbKhJcGJ5cGcvFMeERgucmvIRoS6sA6jNvJW8JsxUIJUe1Gl+xEkYTMQObYIg3JLw/d14QbJipP68XvJ6t8JU4GpXEm0/mdwKOj0dJ1asANJ0FWNbRRB7+TjrRxnS1D+HtWasNrlf5ExhLjl0Ne0j2SJ7qyi6e/swzHuhGtY01dgvNbTurfNE9u5KyZEwOnDNTznE+L22x1OmoEG2+HR331etmVTeOyIuvmiFfGnKIK+ZxXLmLsPl0yLhO32ffG+9/xk0mEm9ogQ5ihQ5wLYTU0hF9Pv3P8J1Fv7Owvvx+dkvpM0naaONKhCDNUhbLZUBGD9iHbUfpK+tbat2PosAqHjdA9fr0V4FzAeQ8/z/tq2UdkMzHL0AAAAASUVORK5CYII=";
var encodedImage = customTermsSignatureData.Split(',')[1];
var decodedImage = Convert.FromBase64String(encodedImage);
string connectionString = "";
string containerName = "";
string fileName = "test.png";
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName);
BlobClient blobClient = containerClient.GetBlobClient(fileName);
using (var fileStream = new MemoryStream(decodedImage))
{
// upload image stream to blob
await blobClient.UploadAsync(fileStream, true);
}
// download image to file path
// blobClient.DownloadTo("xxxxxx/test.png");
Upload to Azure Blob:
Download to Desktop:
I need to TarZip(.tar.gz) multiple CSV files that are present in Azure blob storageV2 inside container named input and save resultant file in another container output using SharpZipLib library in C# using Azure function. File Size of CSV's could be up to 3 GB of a single file.
It worked by downloading files from blob in working directory and then tar zip and uploading the tar zip file in blob.
I want to do it with without downloading it directly tarzipping on Blob. As files size is much higher around 4 GB.
public static async void tar()
{
// define blobs you need to use
string connectionString = "XXXX";
string Azure_container_name = "input";
List<string> blobs = ListAllBlobsName(connectionString, Azure_container_name);
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
var sourceContainer = blobServiceClient.GetBlobContainerClient("input");
var desContainer = blobServiceClient.GetBlobContainerClient("output");
var desBlob = desContainer.GetBlockBlobClient("file.tar.gz");
var options = new BlockBlobOpenWriteOptions
{
HttpHeaders = new BlobHttpHeaders
{
ContentType = MimeMapping.GetMimeMapping("file.tar.gz"),
},
};
using (var outStream = desBlob.OpenWriteAsync(true, options).GetAwaiter().GetResult())
using (TarOutputStream tarOutputStream = new TarOutputStream(outStream, Encoding.UTF8))
{
foreach (var blob in blobs)
{
var source = sourceContainer.GetBlobClient(blob);
Console.WriteLine("Adding file "+blob + " in tar zip");
Azure.Storage.Blobs.Models.BlobProperties properties = source.GetPropertiesAsync().GetAwaiter().GetResult();
var entry = TarEntry.CreateTarEntry(blob);
entry.Size = properties.ContentLength;
tarOutputStream.PutNextEntry(entry);
source.DownloadToAsync(tarOutputStream).GetAwaiter().GetResult();
tarOutputStream.CloseEntry();
Console.WriteLine("Added file " + blob + " in tar zip");
Console.WriteLine();
}
tarOutputStream.Finish();
tarOutputStream.Close();
}
}
Regarding the issue, please refer to the following code
// define blobs you need to use
string[] blobs = { "",... };
string connectionString = "";
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
var sourceContainer = blobServiceClient.GetBlobContainerClient("input");
var desContainer = blobServiceClient.GetBlobContainerClient("output");
var desBlob= desContainer.GetBlockBlobClient( "csv.tar.gz");
var options = new BlockBlobOpenWriteOptions {
HttpHeaders = new BlobHttpHeaders {
ContentType = MimeMapping.GetMimeMapping("csv.tar.gz"),
},
};
using (var outStream = await desBlob.OpenWriteAsync(true, options).ConfigureAwait(false))
using (TarOutputStream tarOutputStream = new TarOutputStream(outStream, Encoding.UTF8)) {
foreach (var blob in blobs) {
var source =sourceContainer.GetBlobClient(blob);
BlobProperties properties = await source.GetPropertiesAsync().ConfigureAwait(false);
var entry = TarEntry.CreateTarEntry(blob);
entry.Size = properties.ContentLength;
tarOutputStream.PutNextEntry(entry);
await source.DownloadToAsync(tarOutputStream);
tarOutputStream.CloseEntry();
}
tarOutputStream.Finish();
tarOutputStream.Close();
}
Use the OneDrive SDK to upload files.
At this time, you have to pass the file path, but uploading using the code takes a long time.
Can I upload files even if I pass the temporary file path?
Currently I get the file path after saving the file to the server.
In this case, an issue arises from speed problems.
Is there any way to look at the temporary file path?
public async Task<JObject> UploadLargeFiles(string upn, IFormFile files)
{
var jObject = new JObject();
int fileSize = Convert.ToInt32(files.Length);
var folderName = Path.Combine("wwwroot", "saveLargeFiles");
var pathToSave = Path.Combine(System.IO.Directory.GetCurrentDirectory(), folderName);
var fullPath = "";
if (files.Length > 0)
{
var fileName = files.FileName;
fullPath = Path.Combine(pathToSave, fileName);
using (var stream = new FileStream(fullPath, FileMode.Create))
files.CopyTo(stream);
}
var filePath = fullPath;
var fileStream = System.IO.File.OpenRead(filePath);
GraphServiceClient client = await MicrosoftGraphClient.GetGraphServiceClient();
var uploadProps = new DriveItemUploadableProperties
{
ODataType = null,
AdditionalData = new Dictionary<string, object>
{
{ "#microsoft.graph.conflictBehavior", "rename" }
}
};
var item = this.SelectUploadFolderID(upn).Result;
var uploadSession = await client.Users[upn].Drive.Items[item].ItemWithPath(files.FileName).CreateUploadSession(uploadProps).Request().PostAsync();
int maxChunkSize = 320 * 1024;
var uploadTask = new LargeFileUploadTask<DriveItem>(uploadSession, fileStream, maxChunkSize);
var response = await uploadTask.UploadAsync();
if (response.UploadSucceeded)
{
return
}
else
{
return null;
}
}
Your server's disk is probably not what makes this slow. By default, uploaded files are stored in a temporary directory, which you can save permanently by using CopyTo(FileStream) like you do.
You can skip this step and call IFormFile.OpenReadStream() to obtain a stream to the temporary file, then pass that to the LargeFileUploadTask.
Point is, it's probably the uploading to OneDrive that takes the largest amount of time. Depending on your setup, you may want to save files into a queue directory (the temp file gets deleted after the request completes), and have a background service read that queue and upload them to OneDrive.
I want to open a filestream from a sharepoint file (Microsoft.SharePoint.Client.File) but I don't seem to find out how.
I only have access to Microsoft.SharePoint.Client because the Microsoft.SharePoint package can't be installed due to some errors.
This is the code I have so far:
ClientContext ctx = new ClientContext("https://factionxyz0.sharepoint.com/sites/faktion-devs");
ctx.Credentials = CredentialCache.DefaultCredentials;
Microsoft.SharePoint.Client.File temp = ctx.Web.GetFileByServerRelativeUrl(filePath);
FileStream fs = new FileStream(???);
You can only create a System.IO.FileStream if the file exists on a physical disk (or is mapped to a disk via the Operating System).
Workaround: Are you able to access the raw URL of the file? In which case, download the file to disk (if the size is appropriate) and then read from there.
For example:
var httpClient = new HttpClient();
// HTTP GET Request
var response = await httpClient.GetAsync(... SharePoint URL ...);
// Get the Content Stream
var stream = await response.Content.ReadAsSteamAsync();
// Create a temporary file
var tempFile = Path.GetTempFileName();
using (var fs = File.OpenWrite(tempFile))
{
await stream.CopyToAsync(fs);
}
// tempFile now contains your file locally, you can access it like
var fileStream = File.OpenRead(tempFile);
// Make sure you delete the temporary file after using it
File.Delete(tempFile);
FileStream must map to a file. The following code demonstrates how to get a stream via CSOM, then we can convert it to FileStream by using a temp file.
ResourcePath filepath = ResourcePath.FromDecodedUrl(filename);
Microsoft.SharePoint.Client.File temp = context.Web.GetFileByServerRelativePath(filepath);
ClientResult<System.IO.Stream> crstream = temp.OpenBinaryStream();
context.Load(temp);
context.ExecuteQuery();
var tempFile = Path.GetTempFileName();
FileStream fs = System.IO.File.OpenWrite(tempFile);
if (crstream.Value != null){
crstream.Value.CopyTo(fs);
}
As for Azure function temp storage, you may take a reference of following thread:
Azure Functions Temp storage
Or you can store data to Azure storage:
Upload data to blob storage with Azure Functions
Best Regards,
Baker Kong
Been a while since the question was asked, however, this is how I solved this while I was working on a project. Obviously passing in the credentials directly like this isn't the best way, but due to timing constraints I was not able to convert this project into a newer version of .NET and use Azure AD.
Note that the class is implementing an interface.
public void SetServer(string domainName) {
if (string.IsNullOrEmpty(domainName)) throw new Exception("Invalid domain name. Name cannot be null");
_server = domainName.Trim('/').Trim('\\');
}
private string MapPath(string urlPath) {
var url = string.Join("/", _server, urlPath);
return url.Trim('/');
}
public ISharePointDocument GetDocument(string path, string fileName) {
var serverPath = MapPath(path);
var filePath = string.Join("/", serverPath, TemplateLibrary, fileName).Trim('/');
var document = new SharePointDocument();
var data = GetClientStream(path, fileName);
using(var memoryStream = new MemoryStream()) {
if (data == null) return document;
data.CopyTo(memoryStream);
var byteArray = memoryStream.ToArray();
document = new SharePointDocument {
FullPath = filePath,
Bytes = byteArray
};
}
return document;
}
public Stream GetClientStream(string path, string fileName) {
var serverPath = MapPath(path);
var filePath = string.Join("/", serverPath, TemplateLibrary, fileName).Trim('/');
var context = GetClientContext(serverPath);
var web = context.Web;
context.Load(web);
context.ExecuteQuery();
var file = web.GetListItem(filePath).File;
var data = file.OpenBinaryStream();
context.Load(file);
context.ExecuteQuery();
return data.Value;
}
private static ClientContext GetClientContext(string serverPath) {
var context = new ClientContext(serverPath) {
Credentials = new SharePointOnlineCredentials("example#example.com", GetPassword())
};
return context;
}
private static SecureString GetPassword() {
const string password = "XYZ";
var securePassword = new SecureString();
foreach(var c in password.ToCharArray()) securePassword.AppendChar(c);
return securePassword;
}
I have a form in ASP.NET and in when I fill up the form in the last step it generates a PDF file. I used jsPDF.
What I want is that, the generated pdf file to be send (saved) in Azure storage, does anyone can help me?
Thank you
UPDATE: This is the code that I'm trying, it's working but it's extracting only the text, it doesn't save the pdf as it is:
var account = new CloudStorageAccount(new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials("storageaccount",
"accesskey"), true);
var blobClient = account.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("folderpath");
StringBuilder text = new StringBuilder();
string filePath = "C:\\Users\\username\\Desktop\\toPDF\\testing PDFs\\test.pdf";
if (File.Exists(filePath))
{
PdfReader pdfReader = new PdfReader(filePath);
for (int page = 1; page <= pdfReader.NumberOfPages; page++)
{
ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));
text.Append(currentText);
}
pdfReader.Close();
using (MemoryStream ms = new MemoryStream())
{
using (var doc = new iTextSharp.text.Document())
{
PdfWriter writer = PdfWriter.GetInstance(doc, ms);
doc.Open();
doc.Add(new Paragraph(text.ToString()));
}
var byteArray = ms.ToArray();
var blobName = "test.pdf";
var blob = container.GetBlockBlobReference(blobName);
blob.Properties.ContentType = "application/pdf";
blob.UploadFromByteArray(byteArray, 0, byteArray.Length);
}
}
I found a simple solution, this is what the code does:
string filePath = "C:\\Users\\username\\Desktop\\toPDF\\testing PDFs\\rpa.pdf";
var credentials = new StorageCredentials("storageaccount","accesskey");
var client = new CloudBlobClient(new Uri("https://jpllanatest.blob.core.windows.net/"), credentials);
// Retrieve a reference to a container. (You need to create one using the mangement portal, or call container.CreateIfNotExists())
var container = client.GetContainerReference("folderpath");
// Retrieve reference to a blob named "myfile.pdf".
var blockBlob = container.GetBlockBlobReference("myfile.pdf");
// Create or overwrite the "myblob" blob with contents from a local file.
using (var fileStream = System.IO.File.OpenRead(filePath))
{
blockBlob.UploadFromStream(fileStream);
}
Click on your solution in Visual Studio, then Add => Add Connected Service => Select Azure Storage, then go through the wizard (if you need, create the storage account - the wizard has that option) and, after that, your solution will be configured with all needed settings (connection string included) and VS will open the page with the detailed tutorial on how to use Azure Storage in your browser. As it has the information and needed code pieces, i willnot include it here (likely, it will change in a future, to avoid the deprecated information).
Tutorial about Add Connected Service => Azure Storage functionality.