Print Page | Close Window

DrawText wrong size and position

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2216
Printed Date: 06 May 25 at 9:37AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawText wrong size and position
Posted By: cscooper
Subject: DrawText wrong size and position
Date Posted: 07 Apr 12 at 11:16PM
If I create a new PDF file and call DrawText(100, 100, "Text"), the text appears where I expect it to.

If instead I open an existing PDF file (one I didn't create so I have no idea how it's set up), create a new content stream, and make the same DrawText() call, the text ends up much smaller than I want and isn't in the right position.

It seems likely that the page has a coordinate mapping set up, or some other nonsense, can I just somehow clear all that in the content stream that I create so I get a blank slate to work from?

Thanks,
Chris




Replies:
Posted By: edvoigt
Date Posted: 08 Apr 12 at 10:11AM
Hi,

you are free to use NewPage to get a new blank page (on the end of PDF) and to set all you want as you need, undisturbed by older content of another page. With MovePage comes the so made page on the right position in the document and with DeletePages you may delete all unwished pages.

If you really need the pagecontent, which seems to set something strange, try NormalizePage(0) before your DrawText. It corrects some wrong things in the PDF.


Cheers,
Werner


Posted By: Ingo
Date Posted: 08 Apr 12 at 12:17PM
Hi Chris!

You should have a look at these functionalities:
http://www.quickpdflibrary.com/help/quickpdf/MeasurementAndCoordinateUnits.php
Keep an eye on SetOrigin ;-)

If you write on an existing page then there are always settings like where is coordinate 0,0 (top left, top right, bottom left or bottom right) and which is the fontheight. These settings are relative to your simple drawing (without any further setting) and so you can't be sure where your drawing will be visible on the page.

So SetOrigin and SetTextSize should be the minimum functionalities you should add before your drawing.

Cheers, Ingo



Posted By: cscooper
Date Posted: 12 Apr 12 at 4:30PM
NormalizePage() did the trick - thanks!



Posted By: CrazyTIm
Date Posted: 30 Oct 12 at 6:10AM
Ingo, 

Thanks, SetOrigin put me on the right track! I see bottom left is the default page origin - weird! :)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk