Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jagatnibas

macrumors regular
Original poster
Jul 28, 2008
126
0
i am using libharu to write some texts to pdf file.

i am putting file size as a4, so what's the pixel wise width and height ?

when i do

HPDF_Page_TextOut(page1, 50.00, 50.00, [str UTF8String]);
it starts writing from down to up rather than up to down


i also need some hint in writing multiline texts wordwrapping kind of.

thanks in advance
 
i am putting file size as a4, so what's the pixel wise width and height ?

There is no intrinsic size in pixels. It depends on the pixels-per-inch used to render the page. For example, if you render an A4 page at 150 ppi, the resulting image would be 1240px by 1754px. The same page rendered at 660 ppi would be 4962px by 7014px.


I don't know libharu. You know iOS itself can produce PDF files right? http://developer.apple.com/library/...gPrintingiOS/GeneratingPDF/GeneratingPDF.html
 
Thanks, I used following code to successfully write text into pdf and abandoned libharu. But the problem here is, I see symbols like hyphen, and aphostrophe is getting converted to some garbage characters ! How to rectify that ?

Code:
CGContextSelectFont (pdfContext, "Helvetica-Bold", kHeadingFontSize, kCGEncodingMacRoman);
CGContextShowTextAtPoint (pdfContext, 55, line_point, keytext, strlen(keytext));
 
If I use your code it works fine with this:
Code:
CGFloat kHeadingFontSize = 12.0f;
CGFloat line_point = 50.0f;
const char* keytext = "He said, 'Hello-world'!";

What is keytext? More importantly what encoding is keytext?
 
Stay away from ShowTextAtPoint. It expects your text to be in MacRoman. You can use the standard NSString string drawing methods to draw your text into the context.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.