mender.AddText does not work

Last post 10-19-2011, 2:46 AM by codewarior. 1 replies.
Sort Posts: Previous Next
  •  10-18-2011, 2:58 PM 336334

    mender.AddText does not work .NET

    I am trying to add text to pdf file using Aspose.Pdf.Facades.PdfFileMend.

    this is a code:

    //add number of pages to the fax doc
    Aspose.Pdf.Facades.PdfFileMend mender = new Aspose.Pdf.Facades.PdfFileMend(inStream, outStream);


    //create formatted text
    Aspose.Pdf.Facades.FormattedText text = new Aspose.Pdf.Facades.FormattedText("Total number of Pages: " + PageCount.ToString(),
    System.Drawing.Color.White,
    System.Drawing.Color.Black,
    Aspose.Pdf.Facades.FontStyle.Courier,
    Aspose.Pdf.Facades.EncodingType.Winansi,
    true,
    14
    );
    mender.AddText(text, 1, 1, 780);
    mender.Close();

    inStream.Close();
    outStream.Close(); 
    I can build the file , but text is not visible on background and when sent to printer I am getting error about bad pdf format.


     
  •  10-19-2011, 2:46 AM 336414 in reply to 336334

    Re: mender.AddText does not work

    Attachment: Present (inaccessible)
    Hi Serge,

    Thanks for using our products.

    I have tested the scenario using Aspose.Pdf for .NET 6.3.0 while using one of my sample PDF documents and I am unable to notice any problem. The text is properly being added to the PDF document. I have used the following code snippet to test the scenario. Can you please confirm which version of product you are using ?

    If possible, can you please share the source PDF document so that we can test the scenario at our end. We apologize for your inconvenience.

    [C]
    // get information of source PDF document
    Aspose.Pdf.Facades.PdfFileInfo pinfo = new PdfFileInfo("d:/pdftest/Source-Mend.pdf");
    try
    {
    //add number of pages to the fax doc
    Aspose.Pdf.Facades.PdfFileMend mender = new Aspose.Pdf.Facades.PdfFileMend("d:/pdftest/Source-Mend.pdf", "d:/pdftest/TextMend-updated.pdf");
    //create formatted text
    Aspose.Pdf.Facades.FormattedText text = new Aspose.Pdf.Facades.FormattedText("Total number of Pages: " + pinfo.NumberOfPages.ToString(),
    System.Drawing.Color.White,
    System.Drawing.Color.Black,
    Aspose.Pdf.Facades.FontStyle.Courier,
    Aspose.Pdf.Facades.EncodingType.Winansi,true,14);
    mender.AddText(text,1, 1, 780);
    mender.Close();
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message);
    }

    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
View as RSS news feed in XML