IPXC_Document PlaceWatermark trims strings?
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, 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.
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.
IPXC_Document PlaceWatermark trims strings?
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...
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...
- Tracker Supp-Stefan
- Site Admin
- Posts: 17824
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: IPXC_Document PlaceWatermark trims strings?
Hello whoit,
Why do you need those spaces in the first place?
Have you tried using the horizontal and vertical offset parameters instead:
https://sdkhelp.pdf-xchange.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
Why do you need those spaces in the first place?
Have you tried using the horizontal and vertical offset parameters instead:
https://sdkhelp.pdf-xchange.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
Re: IPXC_Document PlaceWatermark trims strings?
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.
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
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Document PlaceWatermark trims strings?
Hello whoit,
You can calculate the width of the space and shift your x position to that value.
Cheers,
Alex
You can calculate the width of the space and shift your x position to that value.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: IPXC_Document PlaceWatermark trims strings?
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?
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
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Document PlaceWatermark trims strings?
Hello whoit,
Check this post - it holds the method you need:
https://forum.pdf-xchange.com/ ... ze#p102547
Cheers,
Alex
Check this post - it holds the method you need:
https://forum.pdf-xchange.com/ ... ze#p102547
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: IPXC_Document PlaceWatermark trims strings?
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 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
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Document PlaceWatermark trims strings?
Hello whoit,
Please look at my sample and add the required initialization methods to the Content Creator before calling the CalcTextSize method.
Cheers,
Alex
Please look at my sample and add the required initialization methods to the Content Creator before calling the CalcTextSize method.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: IPXC_Document PlaceWatermark trims strings?
Hi Alex -
Where can I find your sample?
Where can I find your sample?
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Document PlaceWatermark trims strings?
Sasha - Tracker Dev Team wrote:Hello whoit,
Check this post - it holds the method you need:
https://forum.pdf-xchange.com/ ... ze#p102547
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: IPXC_Document PlaceWatermark trims strings?
OK, I got it - I didn't realize I had to initialize the Font and Size
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Document PlaceWatermark trims strings?
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ