Changing page zoom of PDF corrupts image conversions


I’m attempting to convert an XPS => PDF (zoom in) => JPEG.
The pdf looks fine after saving, but once converted to a jpeg, it is missing some images. I’m not totally sure which conversion is at fault here, but something is definitely wrong. Here’s some example code and the source xps i’m using:

public static void ZoomBad()
            var inputFile = @"d:\aspose\input\single_bad.xps";
            var outputPdf = @"d:\aspose\output\single_output.pdf";
            var outputFiles = @"D:\aspose\output\pdf_out_{0}.jpeg";

            //XPS => PDF CONVERSION
            using (System.IO.Stream pdfStream =
                                System.IO.File.Open(outputPdf, System.IO.FileMode.Create, System.IO.FileAccess.Write))
            using (System.IO.Stream xpsStream = System.IO.File.Open(
                inputFile, System.IO.FileMode.Open,
                var document = new XpsDocument(xpsStream, new XpsLoadOptions());
                var options = new Aspose.Page.XPS.Presentation.Pdf.PdfSaveOptions();
                var device = new Aspose.Page.XPS.Presentation.Pdf.PdfDevice(pdfStream);
                document.Save(device, options);

            Document pdfDocument = new Document(outputPdf);
            var pageEditor = new PdfPageEditor();

            //EDITING PDF (ZOOM)
            for (var i = 1; i < pdfDocument.Pages.Count; i++)
                var page = pdfDocument.Pages[i];
                pageEditor.ProcessPages = new[] { i };
                pageEditor.Zoom = (float)0.9407069;


            //PDF => JPEG CONVERSION
            pdfDocument = new Document(outputPdf);
            for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
                using (FileStream imageStream =
                    new FileStream(string.Format(outputFiles, pageCount), FileMode.Create))
                    JpegDevice jpegDevice = new JpegDevice(new Resolution(300), 100);
                    jpegDevice.Process(pdfDocument.Pages[pageCount], imageStream);

Source xps: (1.2 MB)

PS: I know you can convert from XPS => JPEG directly, unfortunately this isn’t possible for our process.

Here’s what the missing image looks like side by side:
image.png (82.9 KB)


We have noticed the similar issue at our end while testing the scenario with Aspose.PDF for .NET 20.10 and have logged it as PDFNET-49017 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi, is there any update on this. We are seeing the same thing. When we use zoom, it cuts off edges instead of scaling.


Regretfully, the earlier logged ticket is not yet resolved. Would you kindly share your sample file along with sample code that you are using? We will test it with the latest version and address it accordingly.

Hi Asad,

I have put together what I am seeing. I am seeing the issue when I change the zoom of the pdf, then output to png using the Aspose.Pdf.Devices.PngDevice.

Please see my zip for more info. (842.7 KB)


A separate ticket as PDFNET-51740 has been logged in our issue tracking system for the sake of investigation. We will further look into it and let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.