Consider the following code, using Aspose.Pdf 7.4.0.0:
var path = @"C:\SomeFile.pdf";
using (var doc = new Aspose.Pdf.Document(path)){
//Do Stuff
doc.Save(path);
}
The Save(string) call fails with an IOException when path points to a large file (the one I'm testing with is ~250 MB). It works fine for small- to medium-size files. The call succeeds when saving to a new file path.
In order to save to the same location, it's necessary to instantiate the Document with a writable FileStream, and to call the Document.Save() method that takes no arguments.
This is either a bug, or it needs to be better documented somewhere.
Hi Marc,
Thanks for your inquiry. Can you please download and try latest API of Aspose.Pdf for .Net i.e. 7.9.0? Hopefully your issue will be resolved as we have fixed some memory performance issue in previous releases. If issue persist then please share your sample document via some file sharing services. We will test it at our end and will provide you information accordingly.
Moreover thanks for highlighting Save() overload method issue, I’m afraid subjected overload method was not described in detail in documentation. However, Api documentation already contains the required information. We have updated [documentation](http://www.aspose.com/docs/display/pdfnet/Save+Method)
as well.
Sorry for the inconvenience faced.
Best Regards.
I am experiencing the same problem. Same sizing as well fails around documents larger than 250mb, with a IOException.
We are using the latest ASPOSE.PDF version
https://1drv.ms/b/s!Al2WKhgKd1l9k9sUV0wQpeiZvSndNQ
links to a 280mb PDF file that contains multiple copies of some adobe documentation for testing purposes.
Our actual code rotates 90 degrees and then tries to save:
public static void RotatePage(string FilePath, Int32 PageNumber, Int32 RotationDegrees)
{
using (Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(FilePath))
{
switch (RotationDegrees)
{
case 90:
case -270:
pdf.Pages[PageNumber].Rotate = Aspose.Pdf.Rotation.on90;
break;
case 180:
case -180:
pdf.Pages[PageNumber].Rotate = Aspose.Pdf.Rotation.on180;
break;
case 270:
case -90:
pdf.Pages[PageNumber].Rotate = Aspose.Pdf.Rotation.on270;
break;
case 360:
case -360:
// no idea why this would ever happen but figured I would cover it
return;
break;
default:
throw new Exception(String.Format(“RotatePage was called with an invalid RotationDegrees of {0}”, RotationDegrees));
break;
}
pdf.Save(FilePath);
}
@tkarafon,
We are unable to download 288 MB PDF file, it shows the estimated time in hours and then throw a Network error. Kindly upload this file to any other free file sharer server, e.g. Google drive and then send us its download link.
sorry about that, here is one from google drive…
https://drive.google.com/open?id=18epDWVTuAU7z4nMGt63B-uR-0aKBi0KH
@tkarafon,
We have executed your scenario as follows:
[C#]
string dataDir = @"C:\Pdf\test562\";
RotatePage(@"C:\Pdf\test563\PDFLoop0.pdf", 1, 90);
We can generate an output PDF and it takes 13 minutes to save. We have logged the problem of slow performance under the ticket ID PDFNET-43981 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. Besides this, kindly let us know which Aspose.Pdf for .NET API version you are using.
@tkarafon,
We have tested your scenario with 17.9.0 and could not replicate IOException in our environment. However, we have already logged the problem of slow performance under the ticket ID PDFNET-43981. We will let you know once it is fixed.