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

Moderators: Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, 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: 75
Joined: Tue Jul 07, 2015 3:30 pm

IPXC_Document PlaceWatermark trims strings?

Mon Jun 19, 2017 3:57 pm

Hi -
I'm using IPXC_Document PlaceWatermark and it seems that it is inherently trimming (removing) spaces from the beginning and the end of my strings.
So " hello " becomes "hello".

How can I avoid this?

It is wreaking havoc with my formatting...
 
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 11115
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: IPXC_Document PlaceWatermark trims strings?

Mon Jun 19, 2017 4:08 pm

Hello whoit,

Why do you need those spaces in the first place?
Have you tried using the horizontal and vertical offset parameters instead:
http://sdkhelp.tracker-software.com/vie ... markParams

Also - try adding e.g. non breakable spaces - and see if those are removed from the start and end of your string.

A sample illustrating how exactly you are trying to use the code might also help our devs to check why you are getting the unexpected result you get - so please do consider providing that as well (make sure no licensing info is visible).

Regards,
Stefan
 
whoit
User
Topic Author
Posts: 75
Joined: Tue Jul 07, 2015 3:30 pm

Re: IPXC_Document PlaceWatermark trims strings?

Mon Jun 19, 2017 4:29 pm

Hi -
I simply need the spaces because they are there - meaning, if a client wants them for spacing purposes, I need to keep them.
I suggest that you should not be trimming text without offering a way to turn it off since we can easily trim strings on our own.

What is a non-breaking space when using PlaceWatermark?
(I know what one is for HTML, but how would I add one here?)
EDIT: I tried a non-breaking space (ascii 255) but it printed out as a visible character so this will not work.

As a basic example (without code) - I have a string in which I allow embedded html tags like "<b></b>"
So I process a string: "This is a <b>bold</b> example."
In order for me to print this correctly onto a pdf, I have to perform three PlaceWatermark calls after I parse the string:
1) "This is a " (note the space)
2) "bold" (where the WatermarkParams indicate bold=true and I calculate the new x position based on the width of the previous string)
3) " example." (again, note the space and I calculate the new x position based on the width of the previous string)

If there is a better way to do this, please let me know.
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2104
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Document PlaceWatermark trims strings?

Tue Jun 20, 2017 9:38 am

Hello whoit,

You can calculate the width of the space and shift your x position to that value.

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: 75
Joined: Tue Jul 07, 2015 3:30 pm

Re: IPXC_Document PlaceWatermark trims strings?

Tue Jun 20, 2017 12:38 pm

Hi Alex -

Yes, that is what I am already doing.
The problem is that the width calculation is not very accurate (I'm using VB)

Is there a "text width" function within the Tracker library?
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2104
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Document PlaceWatermark trims strings?

Tue Jun 20, 2017 12:44 pm

Hello whoit,

Check this post - it holds the method you need:
viewtopic.php?f=67&t=26352&p=102547&hilit=CalcTextSize#p102547

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: 75
Joined: Tue Jul 07, 2015 3:30 pm

Re: IPXC_Document PlaceWatermark trims strings?

Tue Jun 20, 2017 2:56 pm

Hi Alex -

I looked into that thread and I am having the same issue the other poster had - I am unable to execute the CalcTextSize without the same error.

My Code:
Dim myCreator As IPXC_ContentCreator
Dim xWid As Double
Dim xHit As Double

Set myCreator = pDoc.CreateContentCreator '''pDoc is an IPXC_Document
myCreator.CalcTextSize 12, "hello", xWid, xHit, Len("Hello")

His Code:
I did find this method which seems should be what I want, but everytime it throws an error 5, invalid procedure call or argument, note HRESULT is not available in vb6
Dim RectWidth As Double
Dim RectHeight As Double
Dim FS As Double
FS = 6
Dim CC As PDFXEditCtl.IPXC_ContentCreator
Set CC = Me.PDF.Doc.CoreDoc.CreateContentCreator
Call CC.CalcTextSize(FS, UserName & " DigSign " & CStr(Now), RectWidth, RectHeight, Len(UserName & " DigSign " & CStr(Now)))
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2104
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Document PlaceWatermark trims strings?

Wed Jun 21, 2017 9:15 am

Hello whoit,

Please look at my sample and add the required initialization methods to the Content Creator before calling the CalcTextSize method.

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: 75
Joined: Tue Jul 07, 2015 3:30 pm

Re: IPXC_Document PlaceWatermark trims strings?

Wed Jun 21, 2017 12:36 pm

Hi Alex -

Where can I find your sample?
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2104
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Document PlaceWatermark trims strings?

Wed Jun 21, 2017 1:15 pm

Sasha - Tracker Dev Team wrote:
Hello whoit,

Check this post - it holds the method you need:
viewtopic.php?f=67&t=26352&p=102547&hilit=CalcTextSize#p102547

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: 75
Joined: Tue Jul 07, 2015 3:30 pm

Re: IPXC_Document PlaceWatermark trims strings?

Wed Jun 21, 2017 1:57 pm

OK, I got it - I didn't realize I had to initialize the Font and Size
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2104
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Document PlaceWatermark trims strings?

Wed Jun 21, 2017 1:59 pm

:)
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 1 guest