LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Parse objects from a PDF file in C++ using .NET
#1
Posted
:
Wednesday, March 20, 2019 9:39:49 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 54
Thanks: 2 times
Was thanked: 10 time(s) in 10 post(s)
Parsing a PDF document is currently unavailable in our CDLL toolkit. However, we do offer this functionality through .NET using the
PDFDocument.ParsePages() method. The solution below contains two projects. The first is a .NET library that parses the objects contained within a PDF document and writes the details of these objects to a given filename. This project compiles to a DLL and must be registered to create a C compatible TLB file.The second C++ application imports the TLB file and provides the filenames for both the PDF document and the text output document and calls the appropriate method from the first project. This project was originally written using version 18 (posted
here), and I have updated it to use our version 20 toolkit and Visual Studio 2017, although Visual Studio 2015 is also supported.
You can run this project by following these steps:
- Download the attached zip file and extract the project
- Open the solution file using Visual Studio
- Build the solution (all that is necessary is the CustomDLL project)
- This assumes that you have installed the version 20 toolkit at "C:\LEADTOOLS 20". You will have to adjust the references otherwise.
- This also assumes your license files are located at "C:\LEADTOOLS 20\Support\Common\License", the default location for version 20. If elsewhere, you can adjust the filepath on line 34 of Class1.cs accordingly.
- Register the output CustomDLL.dll to be used in the PDFDocument project.
- Run the Visual Studio command prompt found under the Start Menu>Visual Studio
- For building to 32 bit, use the "x86 Native Tools Command Prompt for VS2017"
- For building to 64 bit, use the "x64 Native Tools Command Prompt for VS2017"
- Navigate to the output directory of the CustomDLL project (ie PDFDocument\CustomDLL\bin\x86)
- Execute the following command: RegAsm.exe CustomDLL.dll /tlb:CustomDLL.tlb /codebase
- To explicitly call the 32 bit RegAsm.exe, you can reference C:\Windows\Microsoft.NET\Framework\<Framework version>\RegAsm.exe
- To explicitly call the 64 bit RegAsm.exe, you can reference C:\Windows\Microsoft.NET\Framework64\<Framework version>\RegAsm.exe
- Adjust the filenames for PDFFileName and TXTFileName if you prefer
- Rebuild the solution (All that is necessary is the PDFDocument project)
- Run the application. This will create a text file in the C:\temp directory if you have not changed the TXTFileName variable
You can download this application here:
Josh Clark
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Parse objects from a PDF file in C++ using .NET
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.