Font Size not right in PlaceWatermark method

A forum for questions or concerns related to the PDF-XChange Core API SDK

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.
Post Reply
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Font Size not right in PlaceWatermark method

Post by mmasood »

Hi,

I am using the Tracker Core Api 6.0.318.1.

I am setting the FontSize property of the IPXC_WatermarkParams object that is being passes to the PlaceWatermark method but the font size is not coming out correctly. If i set the font to 36 it comes out to be something like 18-20 and if I set it to 18, it is something like 9-10. I have attached the code that I am using. There also a sample pdf file in the folder that I am using for testing.

Regards,
M
Attachments
CoreAPI.zip
(29.67 KiB) Downloaded 126 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Font Size not right in PlaceWatermark method

Post by Sasha - Tracker Dev Team »

Hello mmasood,

I've tested your sample - you are using 50% scale value thus the font size is smaller.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: Font Size not right in PlaceWatermark method

Post by mmasood »

Hi Alex,

I looked at the code and have the following questions:

1. Where exactly in the code is it scaling to 50%?
2. Is it a default value?
3. How can I set it to be 100%?
4. Are there any other default values that I need to be aware of?

Regards,
M
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17893
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Font Size not right in PlaceWatermark method

Post by Tracker Supp-Stefan »

Hello mmasood,

Alex finished for the day already, but while we wait for him to answer tomorrow - I downloaded your sample project and ran it I was asked to select a file - and did so. I picked the PDF that came with the project and after converting the file - I can't see any differences in the font size between the original and the new PDF document. Nor, between the new PDF and the Word doc.
Or am I missing something obvious?

Cheers,
Stefan
Attachments
Fonts-315.pdf
(16.82 KiB) Downloaded 132 times
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: Font Size not right in PlaceWatermark method

Post by mmasood »

Hi Stefan,

I have attached a sample outcome file. I don't know you are not getting any banners on the output file. The header banners in this file are 36 font and the footer banners are 18 font but they do not look like that.

Regards,
M
Attachments
Fonts-130.pdf
(19.86 KiB) Downloaded 135 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17893
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Font Size not right in PlaceWatermark method

Post by Tracker Supp-Stefan »

Hello mmasood,

I extracted the whole folder from the archive in your original post, then ran the .exe inside, selected the existing PDF file - and got the result as attached above. I see the "XForm" objects are there - but there's no text in them. Do I need anything else to run this sample properly?

Regards,
Stefan
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: Font Size not right in PlaceWatermark method

Post by mmasood »

Hi Stefan,

Can you try compiling the project? The exe in the folder might be older and not working properly.

Regards,
M
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Font Size not right in PlaceWatermark method

Post by Sasha - Tracker Dev Team »

Hello mmasood,

In your case the correct code looks like this:

Code: Select all

private void PlaceWatermark(PDFXEdit.IPXC_Document Doc, PDFXEdit.IPXC_Inst Inst)
{
	PDFXEdit.IAUX_Inst aInst = (PDFXEdit.IAUX_Inst)Inst.GetExtension("AUX");
	PDFXEdit.IBitSet bs = aInst.CreateBitSet(Doc.Pages.Count);
	PDFXEdit.IPXC_WatermarkParams wp = Inst.CreateWatermarkParams();
	bs.Set(0, 4); //We will place watermarks on first 4 pages
	wp.Text = "QWERTY";
	wp.Scale = 100;
	wp.FontSize = Convert.ToSingle(50);
	Doc.PlaceWatermark(bs, wp);
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
mmasood
User
Posts: 101
Joined: Fri Sep 18, 2015 9:49 pm

Re: Font Size not right in PlaceWatermark method

Post by mmasood »

Hi Alex,

So this means that the default value of Scale watermark parameter is 50%. Do you have the list of the default value of all the other parameters as it is not on the help site?

Regards,
M
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Font Size not right in PlaceWatermark method

Post by Sasha - Tracker Dev Team »

Hello mmasood,

Well, we do not have this in our help yet. What you can do is to add the text watermark without any other parameters specified and then use the Edit Watermark command available in the end user Editor to see the default parameters.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: Font Size not right in PlaceWatermark method

Post by whoit »

What about the default for the font size Scale?

Is it really 0.5 by default?

If so why?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Font Size not right in PlaceWatermark method

Post by Sasha - Tracker Dev Team »

Hello whoit,

I just found you a better way to look into the default parameters. Use the CreateWatermarkParams method and then you can just debug and look at the parameters that were set by default in the IPXC_WatermarkParams properties.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply