PDF-XChange - Tracker PDF Viewer - TIFF-XChange - Image-XChange - XMF-XChange - Raster-XChange - Support

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
 
whoit
User
Topic Author
Posts: 185
Joined: Tue Jul 07, 2015 3:30 pm

Stroke/Outline issue with ShowTextBlock

Mon Apr 16, 2018 2:37 pm

Hi -

I'm using ContentCreator and ShowtextBlock to add text to my PDF, and I've found an issue when using
Stroke and font size.

Even though I'm using CoreAPI, I've replicated the problem in PDF-XChange Editor and used the screenshots here.

The issue is that the Stroke Width is not absolute, but seems tied to the Font Size instead which gives unusable output.

If you compare these two screenshots, you can see that the only change is the Font Size, but the result has vastly different
strokes:

Image

Image

I would expect the 0.7pt stroke to appear exactly the same, but clearly it does not....
I have the same issue when using Stroke via CoreAPI.
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3025
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Stroke/Outline issue with ShowTextBlock

Tue Apr 17, 2018 7:16 am

Hello Wayne,

Well you have the "Scale relative to target page" checkbox enabled - try experimenting without it.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
whoit
User
Topic Author
Posts: 185
Joined: Tue Jul 07, 2015 3:30 pm

Re: Stroke/Outline issue with ShowTextBlock

Tue Apr 17, 2018 1:12 pm

Unchecking 'relative' only makes the font size exact (instead of auto-scaling up to fit).

However, when the font size is small, the stroke is still way too large:

Image

Plus, since I'm using CoreAPI I would need an equivalent to "scale relative".
I'm also auto-scaling to fit the diagonal and getting the same problem that I originally
posted - giant stroke....
 
Lzcat - Tracker Supp
Site Admin
Posts: 704
Joined: Thu Jun 28, 2007 8:42 am

Re: Stroke/Outline issue with ShowTextBlock

Tue Apr 17, 2018 1:43 pm

Hi Wayne.
You have specified font size 10 pt, and stroke width 1 pt, so you result is exactly as expected.
When you using autosize you enlarging text with stroke, not just text, as you saw before (because autosize does not change font size, but change matrix that affect everything).
When using Stroke via CoreAPI how do you set stroke width and how position text with stroke? If you are changing CTM - it will affect all drawings (coordinates, line widths, fonts size). So if you want to change only font size - you should change only it, but not CTM.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
 
whoit
User
Topic Author
Posts: 185
Joined: Tue Jul 07, 2015 3:30 pm

Re: Stroke/Outline issue with ShowTextBlock

Tue Apr 17, 2018 2:05 pm

I'm using ContentCreator for the Font and Drawing (is that what you mean when you refer to CTM?)

contentCreator.SetStrokeColorRGB(color.RGB);
contentCreator.SetLineWidth(1);
...
contentCreator.ConcatCS(mResMatrix);
...
contentCreator.ShowTextBlock....


So how can I keep the Stroke at a specific value (1pt, 1.5pts, etc) ?
(I see the exact same issue in the Editor as shown by my screenshots)
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3025
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Stroke/Outline issue with ShowTextBlock

Wed Apr 18, 2018 9:42 am

Hello Wayne,

Here's a screenshot from MS Word (that behaves like the Editor):
Capture28.PNG


About CTM:
viewtopic.php?f=66&t=25815&p=101005&hilit=CTM#p101005

What we suspect that you are doing, is changing the text box's size by using the matrix that you have specified and this, of course, changes the Font Size and the Stroke Width accordingly. We'll need a full code sample on what you are doing to tell for sure.
If you want the correct behavior, you would first need to calculate the correct font size by the resulting rectangle size and then place it with the needed stroke.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
whoit
User
Topic Author
Posts: 185
Joined: Tue Jul 07, 2015 3:30 pm

Re: Stroke/Outline issue with ShowTextBlock

Wed Apr 18, 2018 12:53 pm

Hi Alex -

I reviewed the word sample, and you're right (again!) - I was being stupid and confusing font size with thickness.
So, yes, I need a way to apply the stroke after the scaling of the font....

The code I'm using is actually code that you supplied here: viewtopic.php?f=67&t=29823
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3025
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Stroke/Outline issue with ShowTextBlock

Thu Apr 19, 2018 5:47 am

Hello Wayne,

Well, the algorithm should be like this:
1) You calculate the rectangle for the font size (name, parameters) that you need.
2) Then you take the size of the rectangle that you will need to put the text into.
3) Calculate the new font size based on the rectangle proportions scale coefficient (new height/old height).
4) Output the font with the new size and apply stroke to it.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Who is online

Users browsing this forum: No registered users and 3 guests