Using PDFTron PDFNet with UCS4 Python

Q: I want to add a feature to our server that automates adding some PDFs together and adding some personalization of the
PDF books. So I thought of using PDFNet on the server for this.

I wrote a prototype that runs fine on my Mac OSX using Python, but on the server which is a Ubuntu 32-bit version, I get this error:
/var/www/cgi-bin/Lib/_PDFNetPython2.so: undefined symbol: PyUnicodeUCS2_AsUTF8String

It seems that the library is built for UCS2 and the server python version
(2.7.2) is expecting 4 byte unicode (See

this: http://effbot.org/pyfaq/when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2.htm)


any advice? or do you have a version that can run on UCS4 python?

A:

We have recently added support for UCS4 Python. You can download the onofficial build using the following links:

http://www.pdftron.com/id-flkj484s/PDFNetC.tar.gz
http://www.pdftron.com/id-flkj484s/PDFNetC64.tar.gz

Please see libinfo.txt for how to use _PDFNetPython2_ucs4.so.

Btw UCS4 Python will be supported for all future official PDFNet builds.

Q: Almost working…

I tested using python running under cgi-bin (i.e. triggered from a web browser), now I want to make it into a command line script using the exact same code, same files, same location, same parameters I am getting this error:

outputDoc.Save(ofilename, 0)
File “/home/ubuntu/personalize/Lib/PDFNetPython2.py”, line 5255, in Save
def Save(self, *args): return _PDFNetPython2.PDFDoc_Save(self, *args)

Exception: An error occurred while trying to save the file.

The file might be locked, corrupt, or unavailable.

Detailed error:

locale::facet::_S_create_c_locale name not valid

any idea what this might be and how comes it runs well as a cgi script?

A:

fixed - please ignore.

FYI - this was the cure:

http://askubuntu.com/questions/33025/locale-settings-are-not-right-how-can-i-reset-them

On Tuesday, August 7, 2012 4:25:21 PM UTC-7, Support wrote:

Q: I want to add a feature to our server that automates adding some PDFs together and adding some personalization of the
PDF books. So I thought of using PDFNet on the server for this.
 
I wrote a prototype that runs fine on my Mac OSX using Python, but on the server which is a Ubuntu 32-bit version, I get this error:
/var/www/cgi-bin/Lib/_PDFNetPython2.so: undefined symbol: PyUnicodeUCS2_AsUTF8String
 
It seems that the library is built for UCS2 and the server python version
(2.7.2) is expecting 4 byte unicode (See

this: http://effbot.org/pyfaq/when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2.htm)

 

any advice? or do you have a version that can run on UCS4 python?


A:

We have recently added support for UCS4 Python. You can download the onofficial build using the following links:

http://www.pdftron.com/id-flkj484s/PDFNetC.tar.gz
http://www.pdftron.com/id-flkj484s/PDFNetC64.tar.gz

Please see libinfo.txt for how to use _PDFNetPython2_ucs4.so.