Sign In  Sign Up Live-Chat

PdfFileMend.AddText with multi-line text

Last post 07-18-2008, 2:31 AM by Felix.Liu. 7 replies.
Sort Posts: Previous Next
  •  07-01-2008, 9:10 AM 133811

    PdfFileMend.AddText with multi-line text

    Can I use multi-line text with PdfFileMend.AddText?

    If so can you provide me with a sample how it is coded in C#?

    Thanks!

     
  •  07-01-2008, 12:40 PM 133854 in reply to 133811

    Re: PdfFileMend.AddText with multi-line text

    Hello Scott,

    Multi-line text can be added using PdfFileMend.AddText. Please see the following code snippet.

    string inputFile = @"C:\pdftest\Nayyer.pdf";
    string outputFile = @"C:\pdftest\Nayyer_1.pdf";

    PdfFileInfo fileInfo = new PdfFileInfo(@inputFile);
    float height = fileInfo.GetPageHeight(1);
    float width = fileInfo.GetPageWidth(1);
    int rotation = fileInfo.GetPageRotation(1); //get the page rotation
    string couplet1 = "1st line added,"+
    "2nd Line, 3rd line and 4th line";

    PdfFileMend mendor = new PdfFileMend(inputFile, outputFile);
    mendor.IsWordWrap =
    true;
    mendor.AddText(
    new FormattedText(couplet1), 1, 400, 700);

    If you set the value for IsWordWrap to false, all the string will be added in a single line, and if value is set to True, new line will be started once the line reaches right Margin of the page.


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-02-2008, 10:22 AM 134045 in reply to 133854

    Re: PdfFileMend.AddText with multi-line text

    Attachment: Present (inaccessible)

    What I am trying to do is add text that is multi-line even though it is not past the right margin of the document.

    See attached document, number 1 on the left side is text I inserted and I would like to make the text 2 lines if it goes past a certain point on the document.

    Is this possible?

    Thanks!

    Scott

     
  •  07-02-2008, 1:01 PM 134074 in reply to 134045

    Re: PdfFileMend.AddText with multi-line text

    Hello Scott,

    There is an other way to accomplish this, please try the following code snippet.

    Stamp aStamp = new Stamp();
    FormattedText formatText = new FormattedText
    ();
    formatText.AddNewLineText("This is a simpel text "
    );
    formatText.AddNewLineText("This is a 2nd line"
    );
    aStamp.SetOrigin(100, 700);
    aStamp.BindLogo(formatText);
    PdfFileStamp stamper = new PdfFileStamp("C:\\pdftest\\ReplacedText.pdf", "C:\\pdftest\\AdhereText.pdf"
    );
    stamper.AddStamp(aStamp);
    stamper.Close();

    you can add as many lines using   AddNewLineText(); For more information kindly visit http://www.aspose.com/documentation/file-format-components/aspose.pdf.kit-for-.net-and-java/aspose.pdf.kit.stamp.bindlogo.html


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-02-2008, 4:07 PM 134108 in reply to 134074

    Re: PdfFileMend.AddText with multi-line text

    Attachment: Present (inaccessible)
    That is close, but what I would like to do is add this text:

    This is a simple text and if this is too long to fit in the space provided move to the next line.

     

    If the above is too long to fit in the space provided move to the next line.

    See attached output desired.

     

    Thanks!

     

     
  •  07-02-2008, 7:27 PM 134123 in reply to 134108

    Re: PdfFileMend.AddText with multi-line text

    Hello Scott,

    Have you tried using

    formatText.AddNewLineText("This is a simple text");
    formatText.AddNewLineText(
    "and if this is too");
    formatText.AddNewLineText("long to fit in the ");
    formatText.AddNewLineText(
    "space provided move ");
    formatText.AddNewLineText(
    "to the next line");

    Its just a work around, in fact WordWrap is not working properly, I will discuss it with development and will let you update with its status. Sorry for inconvenience.


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-03-2008, 2:08 AM 134157 in reply to 133854

    Re: PdfFileMend.AddText with multi-line text

    Hello Scott,

     

    I have discussed the PdfFileMend.IsWordWrap issue with development team and we have observed that there are some issues in the feature. I have logged it in our defect management system as PDFKITNET-5482 .We try to resolve this issue as soon as possible and will let you know about the status. Sorry for the inconvenience.


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-18-2008, 2:31 AM 136030 in reply to 134157

    Re: PdfFileMend.AddText with multi-line text

    Hi,

    The issue PdfKitNet-5482 has been resolved, Please download and try the attachment "Aspose.pdf.Kit.rar" from http://www.aspose.com/community/forums/thread/133014/zoom-of-a-pdf-and-subsequent-placement-at-certain-position.aspx

    Thanks,


    Felix Liu
    Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
View as RSS news feed in XML