Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

No result trying to save pdf bytes as a new pdf file

$
0
0
Hi, can you please tell me what is wrong with this code. Overall, I am trying to create a pdf object....add pages from various pdf sources and then stream that to a browser, but....to start I am trying to work with the Aspose.Pdf.Generator.Pdf object and when I test the save, the file is not written and when I inspect the variable retVal, the page count is 0. The code reads in a pdf file, writes it back out as A.pdf, which does work, but when I try to write those file contents to a memory stream and then save the Generator.Pdf object, the page out is 0 and no file is written.



Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document("D:\\temp\\xxx.pdf");
System.IO.MemoryStream ms2 = new System.IO.MemoryStream();
pdfDocument.Save(ms2);
pdfDocument.Save("D:\\A.pdf");


Aspose.Pdf.Generator.Pdf retVal = new Aspose.Pdf.Generator.Pdf(ms2);

retVal.Save("D:\\B.pdf");

Viewing all articles
Browse latest Browse all 3131

Trending Articles