PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Unexpected token 'endobj' in PDF stream (Azure Blob)
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4474
Page 1 of 1

Author:  raviteja [ Thu Sep 14, 2023 4:48 pm ]
Post subject:  Unexpected token 'endobj' in PDF stream (Azure Blob)

Error while downloading pdf template from azure blob storage

I am getting an error while downloading a pdf template from azure blob storage, i intend to use this template to fill data and process further in my code without saving in local, and finally upload it back to azure blob.

Error reads as : "Unexpected token 'endobj' in PDF stream. The file may be corrupted. If you think this is a bug in PDFSharp, please send us your PDF file."



below is my code:



BlobClient blobClient = _ClientGet.GetBlobClient(pathAndFileName);

if (await blobClient.ExistsAsync())
{
BlobDownloadInfo download = await blobClient.DownloadAsync();

if (download.ContentLength > 0)
{
byte[] pdfBytes = new byte[download.ContentLength];
await download.Content.ReadAsync(pdfBytes, 0, (int)download.ContentLength);

using (MemoryStream pdfStream = new MemoryStream(pdfBytes))
{
PdfDocument pdfDocument = PdfReader.Open(pdfStream, PdfDocumentOpenMode.Import);
return pdfDocument;
}
}
}

return null;

Author:  TH-Soft [ Thu Sep 14, 2023 8:32 pm ]
Post subject:  Re: Unexpected token 'endobj' in PDF stream (Azure Blob)

See also:
http://forum.pdfsharp.net/viewtopic.php?f=2&t=832

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/