We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

'Input string was not in a correct format' exception received when opening PDF file

The following code was being used to process the attached file when exception message was received:

static bool SavePdfFile(string oldName)
{
bool saveStatus;
var newName = oldName.Replace("Inbox", "Batch");
var newFileInfo = new FileInfo(newName);
newName = newName.Replace(newFileInfo.Extension, "_pgnum.tif");

try
{
var savePdfDocument = new Aspose.Pdf.Document(oldName);

var resolution = new Resolution(200);
var tiffSettings = new TiffSettings
{
Compression = CompressionType.CCITT4,
Depth = ColorDepth.Default,
Shape = ShapeType.None,
SkipBlankPages = true
};

var tiffDevice = new TiffDevice(resolution, tiffSettings);
var pages = savePdfDocument.Pages;
var pgCount = pages.Count;

for (int pg = 1; pg < pgCount + 1; pg++)
{
var saveName = newName.Replace("_pgnum", "_" + pg.ToString("00"));
tiffDevice.Process(savePdfDocument, pg, pg, saveName);
}
savePdfDocument.Dispose();
saveStatus = true;
}
catch (Exception exc)
{
Console.WriteLine("Exception converting PDF Doc to TIF - {0}", exc.Message);
Log.Error(oldName, "Exception converting PDF Doc to TIF", exc.Message);
saveStatus = false;
}
GC.Collect();

return saveStatus;
}

Hi Steve,


Thanks for contacting support.

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-34586. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-34586) have been fixed in Aspose.Pdf for .NET 7.6.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.