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

74 views
Skip to first unread message

Ryan

unread,
Jan 12, 2016, 2:27:32 PM1/12/16
to pdfne...@googlegroups.com
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
}





Ryan

unread,
Jan 21, 2016, 4:44:07 PM1/21/16
to PDFTron PDFNet SDK
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.
Reply all
Reply to author
Forward
0 new messages