Hi, the OMF version is for Delphi/C++Builder, while it looks like you are using Visual Studio. Use the non-OMF version instead, obviously. It's written in the https://litepdf.sourceforge.io/download.html download page too.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I forgot to add, it's usually not needed to link to the .lib file, because the TLitePDF class opens the .dll on the fly. The .lib linking is needed when using the C interface or when you need low level access to the PoDoFo structures.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I read the errors properly, then you use the C++ API, aka the TLitePDF. You need to include in your project both the litePDF.h and the litePDF.cpp. The code in the litePDF.cpp is not part of the litePDF.lib.
If you gave a try to (or at least looked on) the example projects you'll see how it works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I copied your example exactly and it isn't working, wouldn't be asking otherwise. Have you tried compiling this from scratch?
That's hard to believe, because other people do use the examples and they work for them. Check the other (closed) tickets here.
Adding the cpp file causes other compilation issues with the openssl library.
The OpenSSL library? There's no use of the OpenSSL API in the .cpp of the litePDF public API... You surely do something wrong.
To make it clear: To use the C++ API of the litePDF, as is described on the API page you need to add both litePDF.cpp and litePDF.h into your project. Nothing else is needed, as I wrote several times above. You can modify the litePDF.cpp to find the litePDF.dll file (load it from a different place), but it's not needed when you store the litePDF.dll beside the executable you build.
The SDK has these API files in the share/ directory. You do not touch the files in the src/ directory of the SDK when you only want to use the litePDF API. The src/ is there to be able to build the .dll from the sources.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not exactly sure where it was messing up, but apparently, I needed the pdfLite.cpp in both the solution item and as a source file, and there's two separate pdfLite cpp files which makes it confusing. Also, I actually did need to link the .lib file in order for it to compile.
Anyway, I got it working and I'm trying to understand the Podofo object and how to interact with it as the documentation is quite limited I'm having trouble because I don't have the PDB file associated with the .dll. Can you pls provide that?
Last edit: Rizwan Mohammed 2022-08-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do not have those .pdb files. If you need the PoDoFo, then I suggest to build it on your own. It'll help to avoid one layer, which can cause its own trouble (using C++ from a .dll proved to be tricky here). The PoDoFo project documentation and their tools or examples are a good source of information about that project. See its pages ans sources here on the SourceForge.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, was saying the .pdb for litePDF.dll, but I suspect you might be right and I will need to go 1 layer deeper in order for the PoDoFo objects.
It looks like LitePDF does not have support for document level Javascript, I tried to access this with PoDoFo using doc-> GetNamesTree(true)->GetJavaScriptNode(true) which is a valid document and should always work according to the documentation but I get a access violation. The violation comes from litePDF.dll, but I'm not sure if it's through there or actually PoDoFo (screenshot)
I won't build PoDoFo and just assume it's broken if you know anything about it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No no, it is correct, the PoDoFo is part of the litePDF.dll, thus you'd need the litePDF.pdb to get the PoDoFo symbols. Still, I do not provide these, the less for the release build.
I'm afraid you face the problem with the C++ on the .dll level. It is sensitive to many things, one of them being to use the same C++ standard version in your project as is used to build the .dll file. Whether it's it or not I cannot tell for sure.
I do not know what you are trying to achieve with the litePDF, but its aim is for easier drawing into the PDF files and digital signing. What you described above is very low level, you should get better results using the PoDoFo directly, even it takes time and some effort to build all the PoDoFo dependencies.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was able to successfully build Podofo but it did not come with a .lib file. Did you use Linux to code lite PDF? If not, I would love to learn how you were able to build that because my attempts have been unsuccessful. If you could pass along the file if you have it, that would be incredibly helpful as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The litePDF is built on Windows, but its build files are very special. I cannot share it.
With respect of the PoDoFo build, did you consult their README.html? It contains sections describing how to build PoDoFo under Windows: https://sourceforge.net/p/podofo/code/HEAD/tree/podofo/trunk/README.html#l364 Unfortunately, the code view doesn't provide the file as true HTML; it might be easier to read when you download it and open in a browser.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, I'm not looking for LitePDF files, I want to know how you compiled the .lib file to use in LitePDF. If you built PoDoFo on Windows, then you must have had to link to it using the .lib file, where did you get that file? You also must have needed zlib1.dll, which does not get created thru CMake.
Last edit: Rizwan Mohammed 2022-09-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you must have had to link to it using the .lib file
I said the litePDF build is very special and I mean it. There are no .lib files, apart of the litePDF.lib, which is part of the SDK.
Do follow their build instructions, it should work for you, as it worked for many people before you. Unless those people failed to report any issue in the steps. I also suggest to try with the static build first, to avoid problems with C++ linking through .dll files.
I cannot help you more, I'm sorry. This is way out of the litePDF territory.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, the OMF version is for Delphi/C++Builder, while it looks like you are using Visual Studio. Use the non-OMF version instead, obviously. It's written in the https://litepdf.sourceforge.io/download.html download page too.
I forgot to add, it's usually not needed to link to the .lib file, because the TLitePDF class opens the .dll on the fly. The .lib linking is needed when using the C interface or when you need low level access to the PoDoFo structures.
So I tried to add the other .lib file and it's giving me the errors you see in the attachment.
Last edit: Rizwan Mohammed 2022-08-16
Similarly, its requiring the library, otherwise the build fails. Help pls.
If I read the errors properly, then you use the C++ API, aka the
TLitePDF
. You need to include in your project both the litePDF.h and the litePDF.cpp. The code in the litePDF.cpp is not part of the litePDF.lib.If you gave a try to (or at least looked on) the example projects you'll see how it works.
I copied your example exactly and it isn't working, wouldn't be asking otherwise. Have you tried compiling this from scratch?
Adding the cpp file causes other compilation issues with the openssl library.
That's hard to believe, because other people do use the examples and they work for them. Check the other (closed) tickets here.
The OpenSSL library? There's no use of the OpenSSL API in the .cpp of the litePDF public API... You surely do something wrong.
To make it clear: To use the C++ API of the litePDF, as is described on the API page you need to add both litePDF.cpp and litePDF.h into your project. Nothing else is needed, as I wrote several times above. You can modify the litePDF.cpp to find the litePDF.dll file (load it from a different place), but it's not needed when you store the litePDF.dll beside the executable you build.
The SDK has these API files in the
share/
directory. You do not touch the files in thesrc/
directory of the SDK when you only want to use the litePDF API. Thesrc/
is there to be able to build the .dll from the sources.I'm not exactly sure where it was messing up, but apparently, I needed the pdfLite.cpp in both the solution item and as a source file, and there's two separate pdfLite cpp files which makes it confusing. Also, I actually did need to link the .lib file in order for it to compile.
Anyway, I got it working and I'm trying to understand the Podofo object and how to interact with it as the documentation is quite limited I'm having trouble because I don't have the PDB file associated with the .dll. Can you pls provide that?
Last edit: Rizwan Mohammed 2022-08-20
I do not have those .pdb files. If you need the PoDoFo, then I suggest to build it on your own. It'll help to avoid one layer, which can cause its own trouble (using C++ from a .dll proved to be tricky here). The PoDoFo project documentation and their tools or examples are a good source of information about that project. See its pages ans sources here on the SourceForge.
Sorry, was saying the .pdb for litePDF.dll, but I suspect you might be right and I will need to go 1 layer deeper in order for the PoDoFo objects.
It looks like LitePDF does not have support for document level Javascript, I tried to access this with PoDoFo using doc-> GetNamesTree(true)->GetJavaScriptNode(true) which is a valid document and should always work according to the documentation but I get a access violation. The violation comes from litePDF.dll, but I'm not sure if it's through there or actually PoDoFo (screenshot)
I won't build PoDoFo and just assume it's broken if you know anything about it.
No no, it is correct, the PoDoFo is part of the litePDF.dll, thus you'd need the litePDF.pdb to get the PoDoFo symbols. Still, I do not provide these, the less for the release build.
I'm afraid you face the problem with the C++ on the .dll level. It is sensitive to many things, one of them being to use the same C++ standard version in your project as is used to build the .dll file. Whether it's it or not I cannot tell for sure.
I do not know what you are trying to achieve with the litePDF, but its aim is for easier drawing into the PDF files and digital signing. What you described above is very low level, you should get better results using the PoDoFo directly, even it takes time and some effort to build all the PoDoFo dependencies.
I was able to successfully build Podofo but it did not come with a .lib file. Did you use Linux to code lite PDF? If not, I would love to learn how you were able to build that because my attempts have been unsuccessful. If you could pass along the file if you have it, that would be incredibly helpful as well.
The litePDF is built on Windows, but its build files are very special. I cannot share it.
With respect of the PoDoFo build, did you consult their README.html? It contains sections describing how to build PoDoFo under Windows: https://sourceforge.net/p/podofo/code/HEAD/tree/podofo/trunk/README.html#l364 Unfortunately, the code view doesn't provide the file as true HTML; it might be easier to read when you download it and open in a browser.
No, I'm not looking for LitePDF files, I want to know how you compiled the .lib file to use in LitePDF. If you built PoDoFo on Windows, then you must have had to link to it using the .lib file, where did you get that file? You also must have needed zlib1.dll, which does not get created thru CMake.
Last edit: Rizwan Mohammed 2022-09-08
I said the litePDF build is very special and I mean it. There are no .lib files, apart of the litePDF.lib, which is part of the SDK.
Do follow their build instructions, it should work for you, as it worked for many people before you. Unless those people failed to report any issue in the steps. I also suggest to try with the static build first, to avoid problems with C++ linking through .dll files.
I cannot help you more, I'm sorry. This is way out of the litePDF territory.