Technical FAQs

Question

In ImageGear, why am I running into AccessViolationExceptions when I run my application in parallel?

Answer

This issue can sometimes occur if ImGearPDF is being initialized earlier in the application. In order to use ImGearPDF in a multi-threaded program, it needs to be initialized on a per-thread basis. For example, if you have something like this:

ImGearPDF.Initialize();
Parallel.For(...)
{ 
    // OCR code
}
ImGearPDF.Terminate();

Change it to this:

Parallel.For(...)
{
    ImGearPDF.Initialize();
    // OCR code
    ImGearPDF.Terminate();
}

The same logic applies to other ImageGear classes, such as ImGearPage instances or the ImGearRecognition class – you should create one instance of each class per thread, rather than creating a single instance and accessing it across threads. In the case of the ImGearRecognition class, you’ll have to use the createUnique parameter to make that possible e.g.:

ImGearRecognition recEngine = ImGearRecognition(true);

instead of

ImGearRecognition recEngine = ImGearRecognition();
Question

How do I remove XMP Data from my image using ImageGear .NET?

Answer

When removing XMP data in ImageGear, the simplest way to do this is to set the XMP Metadata node to null, like so:

ImGearSimplifiedMetadata.Initialize(); 
doc.Metadata.XMP = new ImGearXMPMetadataRoot();

Or, you can traverse through the metadata tree and remove each node from the tree:

// Example code. Not thoroughly tested
private static void RemoveXmp(ImGearMetadataTree tree)
{
ArrayList toRemove = new ArrayList();
foreach (ImGearMetadataNode node in tree.Children)
{
    if (node is ImGearMetadataTree)
        RemoveXmp((ImGearMetadataTree)node);

    if (node.Format != ImGearMetadataFormats.XMP)
        continue;

    toRemove.Add(node);
}

foreach (ImGearMetadataNode node in toRemove)
    tree.Children.Remove(node);
}
Question

ImageGear .NET v24.6 added support for viewing PDF documents with XFA content. I’m using v24.8, and upon trying to open an XFA PDF, I get a SEHException for some reason…

SEHException

Why might this be happening?

Answer

One reason could be because you need to execute the following lines after initializing the PDF component, and prior to loading an XFA PDF:

// Allow opening of PDF documents that contain XFA form data.
IImGearFormat pdfFormat = ImGearFileFormats.Filters.Get(ImGearFormats.PDF);
pdfFormat.Parameters.GetByName("XFAAllowed").Value = true;

This will enable XFA PDFs to be opened by the ImageGear .NET toolkit.

TAMPA, Fla. – 2021 marks the 30th anniversary for Accusoft Corporation, the longtime leader in content, processing, conversion, and automation technologies for developers.

Headquartered in Tampa, FL, Accusoft was founded in 1991 as Pegasus Imaging, a provider of technology and solutions to the photo and document imaging markets. In 1998, Pegasus Imaging expanded into medical compression technologies. This technology was adopted by some of the largest medical technology companies in the world, including GE Healthcare, McKesson, Phillips Medical Systems, Siemens Medical Solutions, and Toshiba.

Between 2004-2008 Pegasus Imaging acquired TMSSequoia and Accusoft which moved the company into the forms processing and image cleanup technologies. In 2012, Pegasus Imaging was rebranded to Accusoft Corporation. 

Today, after seeing three decades of change and innovation, Accusoft is proud to bring new technologies to market, driven by the goal of improving the document lifecycle experience for businesses and their employees. 

Most recently Accusoft created and launched OnTask and the Accusoft PDF Viewer. OnTask is a workflow automation tool that makes it easy for small to mid-sized businesses to digitally send and fill forms, get signatures on documents, and automate overall business processes.The Accusoft PDF Viewer is a JavaScript SDK that easily integrates into a developer’s web application to enable PDF viewing and annotation features with no server dependencies.

“Every day I am so amazed by the talent and passion of the team we have built at Accusoft,” said Accusoft CEO Jack Berlin. “30 years in business is a testament to our employees, as well as the innovation and quality of the products we bring to the market.”

For more information about Accusoft, please visit https://www.accusoft.com/.

About Accusoft: 

Founded in 1991, Accusoft is a software development company specializing in content processing, conversion, and automation solutions. From out-of-the-box and configurable applications to APIs built for developers, Accusoft software enables users to solve their most complex workflow challenges and gain insights from content in any format, on any device. Backed by 40 patents, the company’s flagship products, including OnTask, PrizmDoc™ Viewer, and ImageGear, are designed to improve productivity, provide actionable data, and deliver results that matter. The Accusoft team is dedicated to continuous innovation through customer-centric product development, new version release, and a passion for understanding industry trends that drive consumer demand. Visit us at www.accusoft.com.

Question

How do I ensure temp files are deleted when closing ImageGear .NET?

Answer

All PDF objects are based on underlying low-level PDF objects that are not controlled by .NET resource manager and garbage collector. Because of this, each PDF object that is created from scratch should be explicitly disposed of using that object’s Dispose() method.

Also, any ImGearPDEContent object obtained from ImGearPDFPage should be released using the ImGearPDFPage.ReleaseContent() in all cases.

This should cause all temp files to be cleared when the application is closed.

Question

I am trying to deploy my ImageGear Pro ActiveX project and am receiving an error stating

The module igPDF18a.ocx failed to load

when registering the igPDF18a.ocx component. Why is this occurring, and how can I register the component correctly?

Answer

To Register your igPDF18a.ocx component you will need to run the following command:

regsvr32 igPDF18a.ocx

If you receive an error stating that the component failed to load, then that likely means that regsvr32 is not finding the necessary dependencies for the PDF component.

The first thing you will want to check is that you have the Microsoft Visual C++ 10.0 CRT (x86) installed on the machine. You can download this from Microsoft’s site here:

https://www.microsoft.com/en-us/download/details.aspx?id=5555

The next thing you will want to check for is the DL100*.dll files. These files should be included in the deployment package generated by the deployment packaging wizard if you included the PDF component when generating the dependencies. These files must be in the same folder as the igPDF18a.ocx component in order to register it.

With those dependencies, you should be able to register the PDF component with regsvr32 without issue.

Question

How do I ensure temp files are deleted when closing ImageGear .NET?

Answer

All PDF objects are based on underlying low-level PDF objects that are not controlled by .NET resource manager and garbage collector. Because of this, each PDF object that is created from scratch should be explicitly disposed of using that object’s Dispose() method.

Also, any ImGearPDEContent object obtained from ImGearPDFPage should be released using the ImGearPDFPage.ReleaseContent() in all cases.

This should cause all temp files to be cleared when the application is closed.

Question

I am combining multiple PDF documents together, and I need to create a new bookmark collection, placed at the beginning of the new document. Each bookmark should go to a specific page or section of the new document.
Example structure:

  • Section 1
    • Document 1
  • Section 2
    • Document 2

How might I do this using ImageGear .NET?

Answer

You are adding section dividers to the result document. So, for example, if you are to merge two documents, you might have, say, two sections, each with a single document, like so…

  • Section 1
    • Document 1
  • Section 2
    • Document 2

…The first page will be the first header page, and then the pages of Document 1, then another header page, then the pages of Document 2. So, the first header page is at index 0, the first page of Document 1 is at index 1, the second header is at 1 + firstDocumentPageCount, etc.

The following code demonstrates adding some blank pages to igResultDocument, inserting pages from other ImGearPDFDocuments, and modifying the bookmark tree such that it matches the outline above, with "Section X" pointing to the corresponding divider page and "Document X" pointing to the appropriate starting page number…

// Create new document, add pages
ImGearPDFDocument igResultDocument = new ImGearPDFDocument();
igResultDocument.CreateNewPage((int)ImGearPDFPageNumber.BEFORE_FIRST_PAGE, new ImGearPDFFixedRect(0, 0, 300, 300));
igResultDocument.InsertPages((int)ImGearPDFPageNumber.LAST_PAGE, igFirstDocument, 0, (int)ImGearPDFPageRange.ALL_PAGES, ImGearPDFInsertFlags.DEFAULT);
igResultDocument.CreateNewPage(igFirstDocument.Pages.Count, new ImGearPDFFixedRect(0, 0, 300, 300));
igResultDocument.InsertPages((int)ImGearPDFPageNumber.LAST_PAGE, igSecondDocument, 0, (int)ImGearPDFPageRange.ALL_PAGES, ImGearPDFInsertFlags.DEFAULT);

// Add first Section
ImGearPDFBookmark resultBookmarkTree = igResultDocument.GetBookmark();
resultBookmarkTree.AddNewChild("Section 1");
var child = resultBookmarkTree.GetLastChild();
int targetPageNumber = 0;
setNewDestination(igResultDocument, targetPageNumber, child);

// Add first Document
child.AddNewChild("Document 1");
child = child.GetLastChild();
targetPageNumber = 1;
setNewDestination(igResultDocument, targetPageNumber, child);

// Add second Section
resultBookmarkTree.AddNewChild("Section 2");
child = resultBookmarkTree.GetLastChild();
targetPageNumber = 1 + igFirstDocument.Pages.Count;
setNewDestination(igResultDocument, targetPageNumber, child);

// Add second Document
child.AddNewChild("Document 2");
child = child.GetLastChild();
targetPageNumber = 2 + igFirstDocument.Pages.Count;
setNewDestination(igResultDocument, targetPageNumber, child);

// Save
using (FileStream stream = File.OpenWrite(@"C:\path\here\test.pdf"))
{
    igResultDocument.Save(stream, ImGearSavingFormats.PDF, 0, 0, igResultDocument.Pages.Count, ImGearSavingModes.OVERWRITE);
}

...

private ImGearPDFDestination setNewDestination(ImGearPDFDocument igPdfDocument, int targetPageNumber, ImGearPDFBookmark targetNode)
{
    ImGearPDFAction action = targetNode.GetAction();
    if (action == null)
    {
        action = new ImGearPDFAction(
            igPdfDocument,
            new ImGearPDFDestination(
                igPdfDocument,
                igPdfDocument.Pages[targetPageNumber] as ImGearPDFPage,
                new ImGearPDFAtom("XYZ"),
                new ImGearPDFFixedRect(), 0, targetPageNumber));
        targetNode.SetAction(action);
    }
    return action.GetDestination();
}

(The setNewDestination method is a custom method that abstracts the details of adding the new destination.)

Essentially, the GetBookmark() method will allow you to get an instance representing the root of the bookmark tree, with its children being subtrees themselves. Thus, we can add a new child to an empty tree, then get the last child with GetLastChild(). Then, we can set the action for that node to be a new "GoTo" action that will navigate to the specified destination. Upon save to the file system, this should produce a PDF with the below bookmark structure…

Bookmarks example

Note that you may need to use the native Save method (NOT SaveDocument) described in the product documentation here in order to save a PDF file with the bookmark tree included. Also, you can read more about Actions in the PDF Specification.

InsurTech SDK

The insurance market is booming. As noted by research firm Deloitte, the property and casualty (P&C) sector saw a massive income uptick in 2018 and steady growth last year that’s predicted to carry forward through 2020. To help manage the influx of new clients and handle more claims, many firms are spending on insurance technology (insurtech) — digital services and solutions that make it possible to reduce error rates and enhance operational efficiency. InsurTech SDKs are important components of this transformation.

Both in-house insurtech solutions and third-party platforms often excel in specific areas but come up short in others, putting insurance firms at risk of writing off potential gains. While solution switching and ground-floor rebuilds offer one route to success, there’s another option that’s more custom to your business needs: software development kits (SDKs). Here’s a look at three top SDKs that offer customized functionality potential.


FormSuite for Structured Forms: Solving for Data Capture

Time is money. The faster insurance companies accurately complete and file documents, the greater their revenue potential. And as noted by KPMG, the need for speed is more pressing than ever. Many insurance sectors have seen substantial increases in both claims and new applications as the COVID-19 crisis evolves. 

As a result, accurate and agile forms processing is critical to keep up with demand. If current insurance software can’t quickly capture forms data, recognize standard form fields, and let users easily create standard form libraries, policy processing falls behind.

FormSuite for Structured Forms makes it easy for developers to build in form identification and data capture that includes comprehensive form field detection with OCR, ICR, and OMR functionality and the ability to automatically identify scanned forms and match them to existing templates.

ImageGear for .NET and C/C++: Simplifying Conversion

Conversion is critical for insurance firms. Depending on the type and complexity of insurance claims, companies are often dealing with everything from Word documents for initial client assessments and .GIF or .JPG images of existing damage to contractor-specific PDFs or spreadsheets that detail necessary materials, time, and labor costs. The result? A mash-up of multiple file types that forces adjusters to spend valuable time searching for specific data instead of helping clients get their claims process up and running. This makes it difficult to recognize value from emerging digital initiatives. 

Accusoft’s ImageGear for .NET and ImageGear for C/C++ empower developers to integrate enterprise-class file viewing, annotation, conversion, and image processing functions into existing applications, allowing staff to both quickly collaborate on key tasks and find essential data across a single, easy-to-search document.

 


ImageGear: Streamlining PDF Capabilities

While insurance technology offers substantive opportunities for end-users to capture, convert, and retain data, this technology can also come with the challenge of increased complexity. According to recent research from PWC, for example, firms looking to capitalize on insurtech potential must be prepared to rapidly develop new product offerings and embrace the expectations

As a result, companies need applications that streamline current functions and allow them to focus on creating cutting-edge solutions. For example, PDF is a file format that is still used by enterprises worldwide to maintain document format consistency and maximize security. When it comes to converting multiple files into a PDF, software can be expensive and introduce data security issues. 

This can all be solved with an SDK like ImageGear, which makes it possible to integrate the total PDF package into any document management application, both reducing overall complexity and freeing up time for staff to work on new insurance initiatives.

Insurtech forms the framework of functional futures in policy applications, claims processing, and compliance reporting, but existing software systems may not provide the complete capability set companies need to make the most of digital deployments. These top SDKs offer insurance IT teams the ability to integrate key services, improve speed, and boost security at scale. Learn more about Accusoft’s SDKs at www.accusoft.com/products