XCPro40 - how do I add text to an existing document?

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

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

Post Reply
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

XCPro40 - how do I add text to an existing document?

Post by pmazurk »

Using VB.Net -
Is there any way other than with watermarks and annotations to add text to an existing PDF with XCPro40? We get PDFs in from clients, and I need to mark each page with an ID number.

Alternatively, can I open an existing PDF with PXCLib40? I can see how I can add the text there.

Thanks -
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by John - Tracker Supp »

Pxclib40 can only be used to create new pages/files - not modifying existing pages files.

You must therefore use the functions available in XCPRO40 and usually watermarks or annotations are the best way to go - you dont say why these dont suit and a watermark is ideal I would have thought for this purpose ...

In version 5 coing later this summer - the functionality of PXCLIB40/XCPRO40 and to some degree the Viewer will all be merged into one set of 'layered' functions available for both page/file creation and modification - provided you hold the required licensing etc for each component.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

I'll see if I can make a watermark work. I haven't found annotations workable because (1) I need the ID number visible at all times, not just when you click the annotation, and (2) annotations can be removed in Adobe Reader X.

Do you have an ETA on the new version yet?

Any suggestions welcome. Thanks for the help.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by John - Tracker Supp »

Hi,

with regards ETA - this is not possible I am afraid - every product in our PDF lineup is being 100% revised this summer - the first products released will be our end user: PDF-XChange Viewer (very shortly), then the PDF-XChange Driver and finally the PDF -Tools with the develoepr SDK variants following after intial settling down periods to allow us to correct and refine each.

I suspect it wioll be late summer/Autumn at the earliest before you see the new libraries.

With regards annotations - it depends on the annotation type as to whether it needs 'Clicking' or not and you can 'Flatten' annotations to avoid the possibility of removal if using our Viewer ActiveX - though I would still suggest watermarks as being a flexible solution.

You also have the option to add headers or footers too ...
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

Having a problem with PlaceType_Range in PXCp_AddWatermark. If I use that setting, and set m_NumRanges to 1 and m_Range to the first element of a 2-element array (aPages(0)) I get an Access Violation error saying I'm trying to access protected memory. Is this functionality supported in VB.Net? If I change to PlaceType_FirstPage and pass null to m_NumRanges the code executes fine. I need a different watermark on each page so I'm calling AddWatermark once per page.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17929
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by Tracker Supp-Stefan »

Hello pmazurk,

Before asking our devs to check this, could you please ensure that you are using the latest builds of our SDKs - the current latest is build 195, and if you are - please post a snipped showing how you are trying to place the watermark.

Best,
Stefan
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

Looks like I'm using 193. I'll download the updates and try it again. Thanks -
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17929
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by Tracker Supp-Stefan »

You are welcome pmazurk,

Please let us know how it goes with the latest version!

Best,
Stefan
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

I updated the files and still no luck.

I modified the frmWatermark files from the demo in the PDF-Tools 4 SDK\Examples\SDKExamples\VBNetExamples\PXCProDemo folder to include a Page Range option. I get the same error so it should be useful for finding the problem. The modified files are in the attached zip.
Attachments
frmWatermark.zip
(8.44 KiB) Downloaded 186 times
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6900
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by Paul - Tracker Supp »

HI pmazurk,

we will investigate what is the issue with using PXCp_AddWatermark and VB.net We have opened a Support Request Ticket to track the progress of this: RT#1101: XCPro40 - how do I add text to an existing document?

In the meanwhile you might want to look into creating a new document of the same number of pages with the content you want to add then use pxcp_placecontent to combine them.

hth
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

Hi Paul - any update on this?

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

Re: XCPro40 - how do I add text to an existing document?

Post by Tracker Supp-Stefan »

Hello pmazurk,

I am afraid that there is no new info in the ticket.
I have noted your update in there, and we will post here as soon as our devs get the chance to investigate this.

Best,
Stefan
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: XCPro40 - how do I add text to an existing document?

Post by Corwin - Tracker Sup »

Hello pmazurk,

Please note, that you cannot pass managed array to unmanaged code. To pass pages array you need to convert it to unmanaged byte array:

Code: Select all

 Dim aPages(2) As Integer
 aPages(0) = CInt(txtStartPage.Text)
 aPages(1) = CInt(txtEndPage.Text)
 With theWatermark
     .m_NumRanges = 1
     .m_Range = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(aPages(0)) * aPages.Length)
     System.Runtime.InteropServices.Marshal.Copy(aPages, 0, .m_Range, aPages.Length)
     .m_PlaceType = XCPro40_Defs.PXC_WaterPlaceType.PlaceType_Range
 End With
and don't forget to free memory in the end:

Code: Select all

Marshal.FreeHGlobal(theWatermark.m_Range);

HTH
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

Corwin - that's perfect. Thanks for the help.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17929
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by Tracker Supp-Stefan »

Hello pmazurk,

Shall we consider the ticket resolved then?

Best,
Stefan
pmazurk
User
Posts: 27
Joined: Tue Feb 22, 2011 10:25 pm

Re: XCPro40 - how do I add text to an existing document?

Post by pmazurk »

yes. Please consider this ticket closed.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6900
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: XCPro40 - how do I add text to an existing document?

Post by Paul - Tracker Supp »

Hi pmazurk,

that's great to hear. I have closed the ticket.

regards
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply