Getting exception when trying to use PWS and on-premises conversion with PDFNet

Q:

I just registered for PWS and am trying to use it to convert to XOD, but I get the following exception.

pdftron.Common.PDFNetException: Your license does not include WebPublisher permission. at pdftron.PDF.Convert.FileToXod(Native Method) at pdftron.PDF.Convert.toXod(Convert.java:1338)

This is my code

PDFNet.initialize("your_key"); PDFNet.connectToCloud("your API_ID", "your API_Secret"); Convert.toXod("input_file_path", "output_file_path");

What am I doing wrong?

A:

There is actually an error occurring when you are calling PDFNet.connectToCloud so you need to check the return code.

PDFNet.initialize("your_key"); int err_code = PDFNet.connectToCloud("pws_api_id", "pws_api_secret"); if(err_code != PDFNet.e_status_ok) { String err_msg = "Unexpected error. If this error persists please go to pdftron.com/kb_cloud_error"; switch(err_code) { case PDFNet.e_status_network_err : err_msg = "Can’t establish a connection due networking error; Check your connectivity to the internet and firewall settings.If this error persists please go to pdftron.com/kb_cloud_error"; break; case PDFNet.e_status_bad_Credentials : err_msg = "Credentials provided for authentication are incorrect. Make sure you are subscribed to pay as you go plan. You can check your subscription plan and credentials at api.pdftron.com"; break; case PDFNet.e_status_service_down : err_msg = "Server is not responding. If this error persists please go to pdftron.com/kb_cloud_error"; break; case PDFNet.e_status_invalid_operation : err_msg = "Unexpected internal server error. If this error persists please go to pdftron.com/kb_cloud_error"; break; } System.out.println("ERROR ConnectToCloud: " + err_msg); // or optionally throw instead here with the above error message }

If you are using one of the many command line tools, such as DocPub, that work with PWS, to get the same error message add

--verb 2

to your command line.