We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Visual Studio 2019 Won't Build for Linux Remote on C++

@sulox45

Please feel free to reach us in case you need further assistance.

I have one more error I am now encountering. I’m attempting to detect if the PDF file contains javascript in it.

In my code I am doing the following:

auto doc = MakeObject(path);
auto javascript = doc->get_JavaScript();
javascript->get_Keys();

When I run the application I get the error below. If I remove the line above “javascript->get_Keys();” the application outputs all of the metadata contained in the PDF, so I know it is reading the PDF file correctly. When I did something similar in a java implementation of this I did this worked. I’m not sure what I am doing wrong here.

: ~/src/example $ sudo ./build_gcc.sh

SRC Root:

SHARED LIB PREFIX:

– The CXX compiler identification is GNU 6.5.0

– Check for working CXX compiler: /usr/bin/g+±6

– Check for working CXX compiler: /usr/bin/g+±6 – works

– Detecting CXX compiler ABI info

– Detecting CXX compiler ABI info - done

– Detecting CXX compile features

– Detecting CXX compile features - done

– Project name: Aspose.Pdf.Cpp.Example

– Configuring done

– Generating done

– Build files have been written to: /home/ubuntu/src/example/build

Scanning dependencies of target Aspose.Pdf.Cpp.Example

[ 33%] Building CXX object CMakeFiles/Aspose.Pdf.Cpp.Example.dir/source/convertUtil.cpp.o

[ 66%] Building CXX object CMakeFiles/Aspose.Pdf.Cpp.Example.dir/source/main.cpp.o

/home/ubuntu/src/example/source/main.cpp: In function ‘ int main(int, char)** ’:

/home/ubuntu/src/example/source/main.cpp:59:21: error: invalid use of incomplete type ‘ System::SmartPtrAspose::Pdf::JavaScriptCollection::Pointee_ {aka class Aspose::Pdf::JavaScriptCollection}

javascript -> get_Keys();

^~

In file included from /home/ubuntu/src/example/source/main.cpp:8:0 :

/home/ubuntu/src/example/…/include/Aspose.PDF.Cpp/Document.h:296:42: note: forward declaration of ‘ System::SmartPtrAspose::Pdf::JavaScriptCollection::Pointee_ {aka class Aspose::Pdf::JavaScriptCollection}

namespace Aspose { namespace Pdf { class JavaScriptCollection ; } }

**^~~~~~~~~~~~~~~~~~~~**

At global scope:

cc1plus: warning: unrecognized command line option ‘ -Wno-inconsistent-missing-override

CMakeFiles/Aspose.Pdf.Cpp.Example.dir/build.make:86: recipe for target ‘CMakeFiles/Aspose.Pdf.Cpp.Example.dir/source/main.cpp.o’ failed

make[2]: *** [CMakeFiles/Aspose.Pdf.Cpp.Example.dir/source/main.cpp.o] Error 1

CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/Aspose.Pdf.Cpp.Example.dir/all’ failed

make[1]: *** [CMakeFiles/Aspose.Pdf.Cpp.Example.dir/all] Error 2

Makefile:83: recipe for target ‘all’ failed

make: *** [all] Error 2

./build_gcc.sh: line 13: ./Aspose.Pdf.Cpp.Example: No such file or directory

@sulox45

return type of doc->get_JavaScript() is JavaScriptCollection, so you should include “Aspose.PDF.Cpp/JavaScriptCollection.h”

The common rule is “include corresponding header for type if you want create object or use functions of that type”.

As usually, name of header file corresponds with class name (Document, Page, JavaScriptCollection, etc). Some headers are grouped in subfolders by themes: IO, InteractiveFeatures, Text, etc. Have to notice that Javascript is not supported in 20.4 version as we are going to add its support in upcoming release i.e. 20.5.

Thanks, that worked. Just so I understand, are you saying in version 20.4 it won’t detect javascript and that will be available in 20.5? That is the primary feature we need for this use case so we won’t be able to move forward with the purchase until that is available.

@sulox45

You can try to get JavaScript however, proper working with JavaScript features will be available in 20.5 version which will be available in coming month.

I see. I was able to get the application working with the base functionality I needed for my POC which included detecting and removing JavaScript. Although when I used the document->get_Javascript()->get_Keys()->idx_get(keyName) it kept crashing. Should I just wait for the next version then to implement that? Also when will that be coming out about? Either way we will be moving forward with the purchase. Thanks for all the help.

@sulox45

Yes, the application crashing is due to absence of required support in the current version. The upcoming version of the API will be available in starting weeks of next month and we will inform you as soon as it is available. Meanwhile, please keep using our API and in case of any assitance, please feel free to let us know.