PDFXC AddWatermark example error: unable to load dxclib40

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

ase technologies
User
Posts: 22
Joined: Wed Mar 21, 2012 10:55 pm

PDFXC AddWatermark example error: unable to load dxclib40

Post by ase technologies »

The goal of my current project is to add a string of text to each page of a PDF. The string of text could be different for each page. For every page the string has to be a specific size and font, and in a particular location. I've been told that a text watermark could be what I'm looking for, but they look a bit over complicated for our needs. Might there be an easier solution?


The issue that I'm currently having is related to the PDFXC example project that comes with your SDK. When debugging (and stepping through) the watermark example in your PDFXCDemo application, the following error is flagged when the PDFXC_Funcs.PXC_AddWatermark(pdf, ref wt) method is called in the ex_water class:
Unable to load DLL 'pxclib40': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The error makes sense because that library is not referenced in the project, but when I try to add the library and recompile, I get the errors below. I'm attempting to add the library from your installed examples\bin directory to the provided sample solution (PDFXC) . I'm running Visual Studio 2010 on a x86 Win 7 machine. I have the latest (as of yesterday) trial version of your PDFSDKPRO4 package installed. Today we purchased a retail license, but I have yet to setup the license on my machine.

Project errors:
Error 2 The "ResolveManifestFiles" task failed unexpectedly.
System.ArgumentException: Illegal characters in path.
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.Util.RemoveDuplicateItems(ITaskItem[] items)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.Util.SortItems(ITaskItem[] items)
at Microsoft.Build.Tasks.ResolveManifestFiles.set_NativeAssemblies(ITaskItem[] value) PDFXC

Error 3 The "NativeAssemblies=@(NativeReferenceFile);@(_DeploymentNativePrerequisite)" parameter for the "ResolveManifestFiles" task is invalid. PDFXC

Error 4 The "ResolveManifestFiles" task could not be initialized with its input parameters. PDFXC

What are these ResolveManifestFiles tasks? Should I be doing something differently? Should I not be debugging the sample project provided?

I am able to run the CSharpPXCDemo.exe application in your "C:\Program Files\Tracker Software\PDF-XChange PRO 4 SDK\Examples\Bin" directory without an error. My issue only seems to be with stepping through the example project.


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

Re: PDFXC AddWatermark example error: unable to load dxclib4

Post by John - Tracker Supp »

Hi,

You appear to be using the .PXC_AddWatermark( ... function which is used only to add watermarks only when creating new pdf files/pages - I assume you are adding text to an existing PDF file page and therefore should be using the PXCp_AddWatermark(

Please understand the seperation of the 2 libraries functions :

PXCLIB40,DLL (PXC_) functions can only be used when creating new files and pages whereas XCPRO40.DLL (PXCp) functions are used to modify existing files.

Also - the dll's must be located in the same folder as as your project binaries to run and there are interdepenancies - so both PXCLIB40.dll and XCPRO40.DLL are always required along with other dll's - see the full list of files for distribution/installation to ensure you ahve all files requried when using/redistributing on page 19 of the PDF manual : PDF-ToolsV4SDK.pdf

HTH
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
ase technologies
User
Posts: 22
Joined: Wed Mar 21, 2012 10:55 pm

Re: PDFXC AddWatermark example error: unable to load dxclib4

Post by ase technologies »

I got very similar (almost identical) results when debugging the XCPro40Demo.

When the XCPro35_Defs.PXCp_AddWatermark(m_pdf, ref theWatermark) method is called a DllNotFoundException is thrown:

Unable to load DLL 'xcpro40': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)

The library does not come referenced in the project, so I understand the error. But when I try to load that library (or any libray on page 19 other than pxclib40.dll) I get the following error.

A reference to C:\Program Files\Tracker Software\PDF-XChange PRO 4 SDK\Examples\Bin\xcpro40.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

Should I bet geting the library from somewhere else? Do you have the latest x86 version of the library available for download?

Cheers!
ase technologies
User
Posts: 22
Joined: Wed Mar 21, 2012 10:55 pm

Re: PDFXC AddWatermark example error: unable to load dxclib4

Post by ase technologies »

Prior to posting my last reply I copied all of the libraries in your examples\bin directory to where my project binaries are located. I recieved the same "reference could not be added" error when attempting to reference xcpro.dll from the folder where my project binaries are located. pxclib40 is the only library that does not give me this error when adding a reference to the project.

However, if I try to complie the project with just a reference to pxclib40.dll I get the "ResolveManifestFiles" task failed error (again).


Error The "ResolveManifestFiles" task failed unexpectedly.
System.ArgumentException: Illegal characters in path.
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.Util.RemoveDuplicateItems(ITaskItem[] items)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.Util.SortItems(ITaskItem[] items)
at Microsoft.Build.Tasks.ResolveManifestFiles.set_NativeAssemblies(ITaskItem[] value) XCPro40Demo
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom

Re: PDFXC AddWatermark example error: unable to load dxclib4

Post by John - Tracker Supp »

Could it be that you are using the wrong set of DLL's?

Are you ensuring that you are using 32 bit or 64 bit versions depending on your development enviroment ?

If you are 100% sure you are - please advise which of our example app's you are trying to compile and we will text here and compile and send you the project in full with correct dll's etc so you can be 100% sure that what you are attempting to use is what you should be using ...

I have attached here the C# 32 bit compiled project, source code and correct 32 bit dll's - if attempting to compile there - you will need to ensure the paths to the libraries are in keeping with your installation paths as they exist there - which may well differ - but you should for sure be able to run the 'exe' already compiled with the dll's provided.
You do not have the required permissions to view the files attached to this post.
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