Print Page | Close Window

SetTextMode function is not working for me. Why?

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=2261
Printed Date: 28 Sep 24 at 10:56PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: SetTextMode function is not working for me. Why?
Posted By: ExchangeViews
Subject: SetTextMode function is not working for me. Why?
Date Posted: 12 May 12 at 9:17AM
Using D2009 and QPL8.15 with following code:
QP.SetMeasurementUnits(1);
QP.SetTextMode(1);
QP.SelectPage(1);
QP.SetOrigin(1);
QP.SetTextSize(25);
QP.DrawRotatedText(TXTH , TXTH, Angle, TXT);

but the output is not showing Outline text. In fact it is also not showing Fill then stroke text. How to use this function for "Fill then stroke text"and how to fill desired color. Any help? Thanks in advance.



Replies:
Posted By: ExchangeViews
Date Posted: 12 May 12 at 9:28AM
Hi all,
Changing the order of code lines fixed the outline issue as below...but how to set the outline color?
QP.SetMeasurementUnits(1);
QP.SelectPage(1);
QP.SetOrigin(1);
QP.SetTextMode(1);
QP.SetTextSize(25);
QP.DrawRotatedText(TXTH , TXTH, Angle, TXT);

Thanks


Posted By: edvoigt
Date Posted: 12 May 12 at 2:06PM
Hi,

no problem. By default textcolor and linecolor is black. You should change them:

  QP.SetTextSize(25);
  QP.SetTextMode(2);            // both: outline and fillcolor
  QP.SetLineColor(0, 0, 0);     // color for outline
  QP.SetLineWidth(0.5);         // thickness of outline
  QP.SetTextColor(0.5, 0.5, 1); // textcolor=fillcolor
 
With SetTextMode(1) you do not need SetTextColor. It's needed for TextMode(2).

Choose LineWidth depending on TextSize and beware for millimeters (LineWidth) and points (TextSize).


Cheers,

Werner


Posted By: ExchangeViews
Date Posted: 15 May 12 at 9:40AM
Thanks a lotClap!!! It is working great.
Now I want to draw text beneath the page content (i.e. in background). Is there any function available?


Posted By: edvoigt
Date Posted: 15 May 12 at 9:58AM
Hi,

yes it is.

Because a PDF-Reader is working like an interpreter, the order in which the draw-commands are in the PDF determes who lays on whom, we must draw all Backgroundinfo first and the content later.

So it is rather clear for a new PDF-page. But how to do it on a existing PDF?

In a first step we take the the hole existing content from a existing page and build a new one in same dimensions. This goes over capturepage-functions. On the new page we put first our backgroundstuff and put as second the captured page on it. That's all.

For an example look at: http://www.quickpdf.org/forum/stamping-with-a-rotated-shadowed-text-www-link_topic2081_post8876.html?KW=watermark#8876 - http://www.quickpdf.org/forum/stamping-with-a-rotated-shadowed-text-www-link_topic2081_post8876.html?KW=watermark#8876

There I used an example from Andrew, to bring a watermark under the pagecontent.


Cheers again,

Werner


Posted By: ExchangeViews
Date Posted: 15 May 12 at 10:09AM
Thanks for your prompt reply. Going to implement now...


Posted By: ExchangeViews
Date Posted: 15 May 12 at 12:37PM
Dear Werner, everything is perfect but the output page text is overwritten and not displaying correctly. Any help?


Posted By: ExchangeViews
Date Posted: 15 May 12 at 1:03PM
I figured out the problem, It is when we add watermark with SetTextMode(1 or 2) function. It is creating the outline on the characters of captured page. Any suggestion?


Posted By: edvoigt
Date Posted: 21 May 12 at 6:24PM
Hi,

only a remark.

Put around the Watermark-code a SaveState and LoadState, so after this all (I hope) PDF-options like Colors, Sizes, Textmode ... are in the State as before SaveState and will no more disturb drawing the captured page.

SaveState;
Watermark;
LoadState;       // as it was
DrawCaptured;

This solution is ever a help, if you have to mix something.

In your case, SetTextMode(0) before Drawcaptured would be enough, but if you change the watermark-drawing, it may get other bad influence to the captured page.

Cheers,

Werner


Posted By: ExchangeViews
Date Posted: 22 May 12 at 9:47AM
Thanks. But if I use QP.NormalizePage(0) for rotated pages, It is showing just a blank page.

NormalizePage
SaveState;
Watermark;
LoadState;       // as it was
DrawCaptured;


Posted By: edvoigt
Date Posted: 22 May 12 at 10:05AM
Hi,

to understand what happens, ask the QPL for the Rotation inside your PDF before and after NormalizePage.

Description
Moves and/or rotates the contents of the page so that subsequent drawing operations are at the
expected position on the page. All the page boundary boxes are adjusted to the physical size of the page and the page's rotation attribute is reset to zero.

I believe, you make after NormalizePage your Rotation with the before calculated angle and put so the pagecontent outside the visible area.


Cheers,

Werner



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