Startxref not found with QR Code

When we are accessing an image and go to detect a QR Code, we get the following error. Do you know what would cause this?

Aspose.Pdf.InvalidPdfFileFormatException: Startxref not found.

@eNoahAdmin

Would you please provide sample code snippet and sample PDF for our reference? We will test the scenario in our environment and address it accordingly.

We are getting the error in the following code snippets.

Compression:

                    using (Aspose.Pdf.Document docs = new Aspose.Pdf.Document(item1.FullName))
                    {
                        var optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
                        optimizationOptions.RemoveUnusedObjects = true;
                        optimizationOptions.RemoveUnusedStreams = true;
                        optimizationOptions.AllowReusePageContent = true;
                        optimizationOptions.LinkDuplcateStreams = true;
                        optimizationOptions.UnembedFonts = true;
                        optimizationOptions.ImageCompressionOptions.CompressImages = true;
                        optimizationOptions.ImageCompressionOptions.ImageQuality = 50;
                        optimizationOptions.ImageCompressionOptions.ResizeImages = true;
                        optimizationOptions.ImageCompressionOptions.Version = Aspose.Pdf.Optimization.ImageCompressionVersion.Fast;
                        optimizationOptions.ImageCompressionOptions.MaxResolution = 200;

                        docs.OptimizeResources(optimizationOptions);
                        docs.Save(ConvertedImagePath1);
                        docs.Dispose();
                    }

Grayscale Conversion:

                    using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(item.FullName))
                    {
                        Aspose.Pdf.RgbToDeviceGrayConversionStrategy strategy = new Aspose.Pdf.RgbToDeviceGrayConversionStrategy();
                        for (int idxPage = 1; idxPage <= document.Pages.Count; idxPage++)
                        {
                            // Get instance of particular page inside PDF
                            Page page = document.Pages[idxPage];
                            // Convert the RGB colorspace image to GrayScale colorspace
                            //strategy.Convert(page);
                            try
                            {
                                strategy.Convert(page);
                            }
                            catch (Exception ex)
                            {
                                WriteErrorLog("ConverttoGrayscalePDF Exception - " + " - " + ex);
                                continue;
                            }
                        }
                        // Save resultant file
                        document.Save(ConvertedImagePath);
                        document.Dispose();
                    }

@eNoahAdmin

Such errors may occur when supplied input document is not a valid PDF or corrupted one. Anyways, we requested you before to share your sample PDF so that we can test the scenario in our environment to reproduce the issue and address it accordingly. Can you please share source PDF as well that you are using and facing the error with?