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

Free Support Forum - aspose.com

Error: "An error exists on this page" in ADOBE READER 8

When I execute the code below, a new Pdf file with the header is generated successfully.

protected void Button1_Click(object sender, EventArgs e)
{
try
{
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
pdf1.Save(@“E:\Pdf1.pdf”);

FileStream fs1 = new FileStream(@“E:\Pdf1.pdf”, FileMode.Open);
FileStream fs2 = new FileStream(@“E:\Pdf2.pdf”, FileMode.OpenOrCreate);

//create PdfPageEditor object
PdfPageEditor pEdit = new PdfPageEditor();
//bind pdf file
pEdit.BindPdf(fs1);
//and assign it to PageSize property of the PdfPageEditor class
pEdit.PageSize = Aspose.Pdf.Kit.PageSize.A4;
pEdit.Alignment = AlignmentType.Center;
pEdit.VerticalAlignment = VerticalAlignmentType.Center;
//save the file
pEdit.Save(fs2);
pEdit = null;

fs1.Close();
fs1.Dispose();
fs2.Close();
fs2.Dispose();

PdfFileStamp fileStamp = new PdfFileStamp(@“E:\Pdf2.pdf”, @“E:\Pdf3.pdf”);

//for version 6.0.0.0 with Pdf.Kit
fileStamp.AddHeader(@“E:\headerimg.gif”, 10, 50, -800);

//for version 6.3.0.0 with Pdf.Facades
//fileStamp.AddHeader(@“E:\headerimg.gif”, 10, 50, 535);

FormattedText HeaderText = new FormattedText(“Header Text”, System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Kit.FontStyle.TimesRoman, EncodingType.Winansi, false, 12);
//for version 6.0.0.0 with Pdf.Kit
fileStamp.AddHeader(HeaderText, 10, 70, 300);

//for version 6.3.0.0 with Pdf.Facades
//fileStamp.AddHeader(HeaderText, 10, 70, 300);

FormattedText HeaderText1 = new FormattedText(DateTime.Now.ToString(“dd-MMM-yyyy”), System.Drawing.Color.Black, System.Drawing.Color.White, Aspose.Pdf.Kit.FontStyle.TimesRoman, EncodingType.Winansi, false, 12);
fileStamp.AddHeader(HeaderText1, 15, 485, 5);

//close PdfFileStamp
fileStamp.Close();
}
catch (Exception ex)
{

}
}

But when I open the File and scroll or try to close it in ADOBE READER 8, I get the following error:
“An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.”

Also when setting the image in the Header, for different versions of DLLs the rightmargin position needs to be changed. Why is it so?

Please let me know as to where I am going wrong.

Hi Priya,

I have managed to reproduce the same problem while adding Header to PDF document. For the sake of correction I have logged it as PDFNEWNET-31369 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are really sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-31369) have been fixed in this update.


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