J
J-Bal
Guest
I am using VS2019 and reading through a pdf report using pdfcopy to extract certain pages to export to a folder on sharepoint oinline using the savebinarydirect command. Since that command needs the memory stream I am trying to figure out how to do that. I am using the code below and it exports the file successfully but the pdf file is empty. I am assuming that is because the memory stream is empty but I am not sure how to get it populated.
Here is my code:
Dim Mstream As New MemoryStream()
doc = New iTextSharp.text.Document(reader_finsum.GetPageSizeWithRotation(1))
pdfCpy = New iTextSharp.text.pdf.PdfCopy(doc, Mstream)
doc.Open()
page = pdfCpy.GetImportedPage(reader_finsum, counter)
pdfCpy.AddPage(page)
Dim creds As New SharePointOnlineCredentials(accountname, SecPass)
Dim client As New ClientContext("https:" & ExportRptPath)
client.Credentials = creds
Microsoft.SharePoint.Client.File.SaveBinaryDirect(client, ExportRptPath, Mstream, True)
doc.Close()
Continue reading...
Here is my code:
Dim Mstream As New MemoryStream()
doc = New iTextSharp.text.Document(reader_finsum.GetPageSizeWithRotation(1))
pdfCpy = New iTextSharp.text.pdf.PdfCopy(doc, Mstream)
doc.Open()
page = pdfCpy.GetImportedPage(reader_finsum, counter)
pdfCpy.AddPage(page)
Dim creds As New SharePointOnlineCredentials(accountname, SecPass)
Dim client As New ClientContext("https:" & ExportRptPath)
client.Credentials = creds
Microsoft.SharePoint.Client.File.SaveBinaryDirect(client, ExportRptPath, Mstream, True)
doc.Close()
Continue reading...