cancel
Showing results for 
Search instead for 
Did you mean: 

PDF Testing

SOLVED
Contributor

PDF Testing

 

PDF Testing:

 

I followed the documentation and downloaded the pdfbox jar files and added the java classes in the Java bridge.

 

And tried executing the below script:

 

function loadDocument(P1)
{
var docObj;
docObj = JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3(P1);
return docObj;
}


function getDocument()
{
docObj = loadDocument("C:\\Work\\P1.pdf");
return test;
}

 

 

This returns an error :

 

JavaScript runtime error.
TypeError: JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3 is not a function
 
Attached the screenshot
 
Also, let me know if there are any configurations more I have to do. I dont know why this function is not identified!
8 REPLIES
Community Hero

Re: PDF Testing

you might not set the javaBridge in Tools > Options > JavaBridge.

https://support.smartbear.com/testcomplete/docs/reference/options/engines/java-bridge.html


Thanks
Shankar R

“You must expect great things from you, before you can do them”


Extension Available

Contributor

Re: PDF Testing

Hello,

  I have set the Javabridge!

 

Please find the screenshot below.

Community Hero

Re: PDF Testing

Okay, If that is the case.

 

Are you able to see Autocomplete when you type JavaClasses.?


Thanks
Shankar R

“You must expect great things from you, before you can do them”


Extension Available

Highlighted
Contributor

Re: PDF Testing

Yes, if this is what you are checking on.Autocomplete.PNG

Community Hero

Re: PDF Testing

I have been using the below code for long time without having any issue.

 

function getPDFObject(fileName)
{
      try
      {
           // Load the PDF file to the PDDocument object
            return JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3(fileName);
      }
      catch(ex)
      {
            Log.Error(ex.stack);     
      } 
      return null;
}

 


Thanks
Shankar R

“You must expect great things from you, before you can do them”


Extension Available

Community Hero

Re: PDF Testing

Hi,

 

Most probably, it's all Java and its versioning...

https://community.smartbear.com/t5/TestComplete-Functional-Web/Getting-exception-while-trying-to-rea...

and

https://community.smartbear.com/t5/TestComplete-Desktop-Testing/Compare-pdf-files/m-p/122339

might help...

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Contributor

Re: PDF Testing

Hello,

  Thank you for your solutions. It was mainly with the jar files I was using.

Now the problem is resolved.

Contributor

Re: PDF Testing

Hi,

 

I am facing the same issue with my PDF testing. In the following line, it does not recognize "load_3"

 JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3

 

Under , Tools>current project properties>Java bridge, I have set the Java classes and Class path (see attached image below). Also, I reverted to an old version of pdfbox.jar (1.8.12) and unblocked the dll's as mentioned in another thread (see CLR Bridge properties attached image). 

 

However, under Tools>options>Java Bridge, I have the Java Virtual Machine module location it set to:

C:\Program Files (x86)\Java\jre1.8.0_161\bin\client\jvm.dll

Should this be bin\server instead of client? I am asking this because I read on this thread that it was changed to server. But in my Java folder there is no server folder.

 

Thank you for any suggestions!!

 

JavaBridge_currentProjectProperties.PNG

 

C:\Program Files (x86)\Java\jre1.8.0_161\bin\client\jvm.dll

 

-Sameer

Watch a new Video
Top Kudoed Authors