IPXC_BackgroundParams

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
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

IPXC_BackgroundParams

Post by Tom Princen »

How do I find out what all of the settings do? The help is not very helpfull...

I have this code: But it does not do anything

IPXC_Document Mydoc = MyPXC.OpenDocumentFromFile(lsSourceFile, clbk);

//System.Windows.Forms.MessageBox.Show(Mydoc.Pages.Count.ToString());

IBitSet MyBitSet = MyIAUX.CreateBitSet(Mydoc.Pages.Count);
MyBitSet.Set(0, Mydoc.Pages.Count);

IPXC_BackgroundParams MyBackground = MyPXC.CreateBackgroundParams();

MyBackground.BackgroundFile = lsBackgroundPdf;
MyBackground.BackgroundType = PXC_BackgroundType.Background_PDF;
MyBackground.BackgroundPage = 1;

Mydoc.PlaceBackgrounds(MyBitSet, MyBackground);


In fact background is probably not exactly what i need. I have a transparant PDF with a barcode and i want to place it as an 'overlay' on a scanned PDF.
(I allready tried with watermark )
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

Hello Tom,

The watermark is probably what you need:
https://sdkhelp.pdf-xchange.com/vie ... eWatermark
Also, try writing your document to file and opening it with Editor and look whether the watermarks were placed.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: IPXC_BackgroundParams

Post by Tom Princen »

Does not work:

IPXC_Document Mydoc = MyPXC.OpenDocumentFromFile(lsSourceFile, clbk);

IBitSet MyBitSet = MyIAUX.CreateBitSet(Mydoc.Pages.Count);
MyBitSet.Set(0, Mydoc.Pages.Count);

IPXC_WatermarkParams MyWatermark = MyPXC.CreateWatermarkParams();

MyWatermark.ImageFile = lsBackgroundPdf;
MyWatermark.ImagePage = 1;
MyWatermark.WatermarkType = PXC_WatermarkType.Watermark_PDF;


Mydoc.PlaceWatermark(MyBitSet, MyWatermark);

Mydoc.WriteToFile(lsOutput);
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

Have you tried executing a sample that was presented in that wiki topic?
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: IPXC_BackgroundParams

Post by Tom Princen »

With text there is no problem:

IPXC_Document Mydoc = MyPXC.OpenDocumentFromFile(lsSourceFile, clbk);

IBitSet MyBitSet = MyIAUX.CreateBitSet(Mydoc.Pages.Count);
MyBitSet.Set(0, Mydoc.Pages.Count);

IPXC_WatermarkParams MyWatermark = MyPXC.CreateWatermarkParams();

MyWatermark.Text = lsWatermarkText;
MyWatermark.WatermarkType = PXC_WatermarkType.Watermark_Text;
MyWatermark.Rotation = 0;

Mydoc.PlaceWatermark(MyBitSet, MyWatermark);

Mydoc.WriteToFile(lsOutputFile);
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

I've updated the sample for the PDF file:
https://sdkhelp.pdf-xchange.com/vie ... eWatermark
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: IPXC_BackgroundParams

Post by Tom Princen »

still no luck: I am using the files in the attachment. Can you have a try?


InitPDFX(MyKey);
CDocAuthCallback clbk = new CDocAuthCallback();
clbk.m_pxsInst = MyIPXS;

IPXC_Document Mydoc = MyPXC.OpenDocumentFromFile(lsSourceFile, clbk);

IBitSet MyBitSet = MyIAUX.CreateBitSet(Mydoc.Pages.Count);
MyBitSet.Set(0, Mydoc.Pages.Count);

IPXC_WatermarkParams MyWatermark = MyPXC.CreateWatermarkParams();

MyWatermark.WatermarkType = PXC_WatermarkType.Watermark_PDF;
MyWatermark.ImageFile = lsBackgroundPdf;
MyWatermark.ImagePage = 0;

MyWatermark.Opacity = 55;


Mydoc.PlaceWatermark(MyBitSet, MyWatermark);

Mydoc.WriteToFile(lsOutput);
Attachments
sample.pdf
(8.02 KiB) Downloaded 125 times
Overlay.pdf
(16.61 KiB) Downloaded 128 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

Tried with your document - works fine here.
Attachments
sample (1).pdf
(28.22 KiB) Downloaded 122 times
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: IPXC_BackgroundParams

Post by Tom Princen »

And how do you make the barcode the right size? It are both A4 documents but he makes the barcode small
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

Please read the help more thoroughly - there are flags that can set that behavior:
https://sdkhelp.pdf-xchange.com/vie ... rmarkFlags

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: IPXC_BackgroundParams

Post by Tom Princen »

As I explained before the help is not very helpfull. Most of the parameters are not explained at all.
Its the first time I see that the enumerations are explained. :)
Please have a look at PXC_TextRenderingMode Enumeration that the normal state of your help...

So sorry for asking questions... I thought the forum was just for asking questions.

I added this line:
MyWatermark.Flags = (uint) PXC_WatermarkFlags.WatermarkFlag_ScaleToPage;

But htis does not change a thing.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: IPXC_BackgroundParams

Post by Tracker Supp-Stefan »

Hello Tom,

We do update the help system on the fly, but usually when we share a link here - the page behind it would have already been updated.
I presume that this was sarcasm:
So sorry for asking questions... I thought the forum was just for asking questions.
Indeed the forums are exactly for that, we didn't mean to offend you - just trying to streamline the process by putting the information in the respective methods pages, and only giving the links in the forums.

I will leave it to Sasha to answer the last part where you still have issues with your code.

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

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

We are trying to fill them as fast as we can, prioritizing the most used first.
Well the forum is for asking questions, though preferably the questions should be asked when the forum topics search (both Core and Editor SDK) and wiki help does not give any clues - thus we will have more time to fill the wiki help with documentation and samples.
I will update the sample and will reply here.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_BackgroundParams

Post by Sasha - Tracker Dev Team »

Hello Tom,

I've updated the sample on the wiki page:
https://sdkhelp.pdf-xchange.com/vie ... ark#Sample
The problem was that you needed to also set the scale value itself to 100%:

Code: Select all

MyWatermark.Flags = (uint) PXC_WatermarkFlags.WatermarkFlag_ScaleToPage;
MyWatermark.Scale = 100;
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply