We are using Aspose.Pdf to extract images from a PDF created by a copier. On Windows Server 2012 the images are being extracted with a black background and white text. On Windows Server 2008 and Windows 7 the images are being extracted with a white background and black text just like the PDF through FoxIt Reader or Acrobat Reader displays.
The exact same code/exe is being run in all the various environments against the exact same pdf. I have uploaded the PDF as "sample.pdf". I have uploaded copies of the TIFFs in the "ExtractedPages.zip" file. The zip file contains a folder for Server 2008 and Server 2012 that shows the output TIFFs from the code below.
Can you help me understand what is going on.
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using Aspose.Pdf;
namespace PdfToTiff
{
class Program
{
static void Main(string[] args)
{
var license = new License();
license.SetLicense("Aspose.Total.lic");
var sourceStream = File.OpenRead("sample.pdf");
var document = new Document(sourceStream);
var pdfImages = document.Pages
.Cast<Page>()
.Select(x => x.Resources.Images[1])
.ToArray();
for (var i = 0; i <pdfImages.Length; i++)
{
var pdfImage = pdfImages[i];
using (var stream = File.OpenWrite("sample-" + i + ".tiff"))
{
pdfImage.Save(stream, ImageFormat.Tiff);
}
}
}
}
}