Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6833783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:01:21+00:00 2026-05-26T23:01:21+00:00

I have a string which is longer than the width of the place where

  • 0

I have a string which is longer than the width of the place where it has to show up. What I want to do is show the string on 2 or 3 lines.

My code is as follows:

for (int i=0; i<claimsCount; i++) 
{
    File_Claim *fileClaim = [claimsArray objectAtIndex:i]; 

    [self checkCreateNewPage:font:10.0];

    ///////////////////////////////////////////////////////////////////////////////////////
    // if the current category is the same as the previous one then don't write it again
    ///////////////////////////////////////////////////////////////////////////////////////
    if ([subcategory isEqualToString:fileClaim.subCategoryName]) 
    {
    }
    else
    {
        // hold the old category to check if it is the same
        subcategory = fileClaim.subCategoryName;
        //HPDF_Page_SetRGBFill (_currentPage, 0, 0, 1);
        posY -= PDF_SPACER_Y;
        HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X, posY, [fileClaim.subCategoryName cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
    }

    //HPDF_Page_SetRGBFill (_currentPage, 0, 0, 0);
    posY -= PDF_SPACER_Y;

    HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X+15, posY, [fileClaim.name cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
    HPDF_Page_TextOut(_currentPage, [self alignRightNumberX:fileClaim.unitPrice:260], posY, [[NSString stringWithFormat:@"%.2f €",fileClaim.unitPrice] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
    HPDF_Page_TextOut(_currentPage, 320, posY, [[fileClaim getCalcString] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
    HPDF_Page_TextOut(_currentPage, [self alignRightNumberX:fileClaim.totalPrice:483], posY, [[NSString stringWithFormat:@"%.2f €",fileClaim.totalPrice] cStringUsingEncoding:NSWindowsCP1252StringEncoding]);
}

And the part where I put my text:

 HPDF_Page_TextOut(_currentPage, PDF_BASE_DATA_LABELS_START_X+15, posY, [fileClaim.name cStringUsingEncoding:NSWindowsCP1252StringEncoding]);

Now this has to come on 2 or 3 lines instead of 1. And I can’t figure out how to do this.

Thanks in advance,

Lewion

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:01:21+00:00Added an answer on May 26, 2026 at 11:01 pm

    I’ve been using LibHaru for few days now, and I came across the same question.. I went into writting my own C function to deal with line breaks and multiline support ; and then today I found out that HPDF_Page_TextRect() can actually do the job for you! 🙂

    It will automatically wrap up words on multilines in a area defined by a Rectangle and it also returns the number of characters written…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string which has an xml inside. I want to write this
I have a string that may be longer than any simple int boundaries. Currently,
I have a string which I need to verify if it's a Country code.
I have a string which has the below content String msg = The variables
I have a string which contains only numbers. Now I want to remove all
I have the following code, which splits up a Vector into a string vector
I have a string which typically is in the format : 0xFF . I'll
I have a string which looks like a hash: { :key_a => { :key_1a
I have a string which looks like this a 3e,6s,1d,3g,22r,7c 3g,5r,9c 19.3 , how
I have a string which is basically a list of words delimited by commas.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.