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

Free Support Forum - aspose.com

Aspose.PDF - AddStamp error "Unable to read beyond the end of the stream."

I am trying to stamp a PDF document and receiving the error. Other PDFs work fine.

Code sample:
saveFileName = Path.Combine(filePath, fileName);

            document = new Aspose.Pdf.Document(saveFileName);

            textStamp = new TextStamp(stamp);
            textStamp.XIndent = xPos;
            textStamp.YIndent = yPos;
            textStamp.TextState.Font = FontRepository.FindFont(fontName);
            textStamp.TextState.FontSize = fontSize;

            foreach (Page docPage in document.Pages)
            {
                docPage.AddStamp(textStamp);
            }

            //Save with stamp
            document.Save(saveFileName);
            document.Dispose();

Error message: Unable to read beyond the end of the stream.

Stack Trace:
at System.IO.BinaryReader.ReadByte()
at ..()
at ...(‹ , & )
at .’.(‹ , & )
at ...(‹ , & )
at .’.(‹ , & )
at ..( )
at ..(Int32 , Int32 )
at ..()
at ..()
at ..()
at Aspose.Pdf.XFormCollection.(String )
at Aspose.Pdf.XFormCollection…ctor(Resources , a )
at Aspose.Pdf.Resources.get_Forms()
at Aspose.Pdf.TextStamp.Put(Page page)
at Aspose.Pdf.Page.AddStamp(Stamp stamp)
I

Hi Mike,


Thanks for your inquiry. Please share your sample PDF document here, so we will look into it and will provide you more information accordingly.

We are sorry for the inconvenience caused.

Best Regards,