- Can I use ABCpdf from Visual Basic?
-
Yes. All the example code will be exactly the same but you'll need to replace ASP specific code like Server.CreateObject with generic code like CreateObject.
- Why doesn't AddImage work with my GIF images?
-
You can pass AddImage a path to a JPEG, TIFF or EMF file. This inserts the raw compressed data into your PDF document. Other image types (e.g. GIF) cannot be inserted direct - they must be drawn into an Image object and then the Image object can be added to the PDF document. There are examples in the ABCpdf documentation.
- I am getting a "Windows error 193. %1 is not a valid Win32 application" error.
-
This is a permissions issue related to the creation of MSHTML objects. Please start by checking the "I am having problems with Security." section of this page.
Sometimes this permissions issue can have a base cause in an old or inconsistent installation of MSHTML. If this is the case then updating IE and restarting may well resolve the issue.
As with all permissions changes take great care. It is vital you ensure you know how to back these changes out should you decide that they are inappropriate. If you are unsure then please do not make any changes.
Open the Component Services control panel. Right click on the 'My Computer' icon to get up generic COM/DCOM permissions. Check the Launch and Access permissions. If your IIS user (typically ASPNET or IUSR_MACHINENAME) does not have Launch and Access permissions it may be denied permissions to create or use MSHTML objects.
The issue may be related to the fact that your IIS user doesn't have "log in a batch job" permissions. Try assigning the permission to that user.
Restart your computer and try your code again.
- How do I use ABCpdf from WebMatrix?
-
The way in which Assemblies are linked from a particular development environment is very much dependent on the development environment. So for best practice you should consult the documentation for your chosen environment.
However you might like to use a register tag to link to the assembly and import the namespace:
<%@ Register TagPrefix="pdf" Namespace="WebSupergoo.ABCpdf6"
Assembly="ABCpdf, Version=8.0.0.5, Culture=neutral, PublicKeyToken=a7a0b3f5184f2169" %>
Obviously you'll need to modify the version and possibly the key to match the assembly you are using.
- Why is Acrobat telling me my fields are malformed after I use ABCpdf to delete them?
-
If you create forms using Adobe Designer (which comes with Acrobat 7) it will make use of some new field references which were not used in version 6.
If fields are deleted and the field references are left intact then Acrobat may complain that the fields are invalid.
To solve the problem delete the AcroForm after deleting the fields. For example:
theDoc.SetInfo theDoc.Root, "/AcroForm:Del", ""
Alternatively if you are simply setting field values then you may be able to achieve what you want by deleting the XFA elements:
theDoc.SetInfo theDoc.Root, "/AcroForm/XFA:Del", ""
- Why might I see "Exception of type 'System.ExecutionEngineException' was thrown."?
-
When certain security attributes are applied to an assembly this may crash the CLR (Common Language Runtime) under .NET 3.5 SP1. The issue is intermittent and the periodicity is related to the environment. We have an open Tech Support incident with Microsoft relating to this. They have confirmed the bug but they have not told us when it will be fixed.
We have worked around this issue in ABCpdf version 7 (minor version 7010).
An alternative would be to remove SP1 and wait for a fix from Microsoft.
- Why am I seeing different PDF output after installing/updating IE8 on my server? (pre-ABCpdf7012)
-
ABCpdf uses the MSHTML component (installed with Internet Explorer) when rendering HTML to PDF.
Although we've always attempted to maintain as much compatibility as possible between ABCpdf and different versions of IE, we've had to introduce changes in ABCpdf version 7 (minor version 7012) in order to interoperate with IE8 when rendering some types of HTML content.
Otherwise, if you come across an issue using IE8 with older versions of ABCpdf you would need to continue to use IE7.
ABCpdf 8 offers a choice between using the MSHTML and Gecko rendering engines.
- Why is Visual Studio 2010 telling me I am referencing .NET 3.0?
-
ABCpdf links into whatever functionality is available in .NET at runtime. It links into .NET 3.0 but will run quite happily against .NET 2.0 with certain elements of functionality disabled.
Unfortunately the ability to do this, available in Visual Studio 2005 and 2008, has been removed in Visual Studio 2010. So Visual Studio 2010 will insist that you target .NET 3.0 even though ABCpdf doesn't actually require it. If this happens you will see errors like this when you try to build:
Compile complete -- 9 errors, 0 warnings
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "ReachFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "ReachFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "UIAutomationProvider, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "UIAutomationProvider, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "UIAutomationTypes, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "UIAutomationTypes, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "ABCpdf" could not be resolved because it has an indirect dependency on the framework assembly "System.Printing, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "ABCpdf" or retarget your application to a framework version which contains "System.Printing, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
Obviously the simplest solution is to change your project target to .NET 3.0. However for those that are unable to do this you can change the project settings manually to enable linking against .NET 2.0.
Suppose you have a project called 'MyProject'. In your Visual Studio 2010 solution:
- Click on the Reference to ABCpdf
- In the Properties window change the 'Specific Version' property to true
- Right click on the project that references ABCpdf and select 'Unload Project'
- Right click on it and select 'Edit MyProject.csproj'
- Find the reference to ABCpdf (which will look something like this)
<Reference Include="ABCpdf, Version=8.0.0.5, Culture=neutral, PublicKeyToken=a7a0b3f5184f2169, processorArchitecture=MSIL" />
- Add in a <SpecificVersion> tag (so it will look something like this)
<Reference Include="ABCpdf, Version=8.0.0.5, Culture=neutral, PublicKeyToken=a7a0b3f5184f2169, processorArchitecture=MSIL">
<SpecificVersion>true</SpecificVersion>
</Reference>
- Save and close the XML file MyProject.csproj
- Right click on the project and select 'Reload project'
- Compile and run
- Converting HTML with IE9 installed, I see the exception: 'ABCpdf could not initiate MSHtml engine for this version of Internet Explorer installed.'
-
Using IE9 on the same system as older ABCpdf versions may cause this error message.
ABCpdf version 8.1 and later are fully compatible with IE9 and also provide a Gecko-based HTML engine.
When converting HTML to PDF, ABCpdf uses the MSHTML component installed with Internet Explorer as the first stage of the process.
The issue when using older ABCpdf versions is related to a set of problems Microsoft introduced in IE9.
We (and other developers) reported these issues to Microsoft in September 2010 but unfortunately they have not been fixed.
Unfortunately with the official release of IE9 Microsoft released new documentation which says the IHTMLElementRender::DrawToDC function that was required has been deprecated.
This is especially unfortunate given that there is no replacement for this function.
Given that Microsoft appears to be unwilling to support these interfaces we would strongly recommend that on new deployments you consider a move to the new Gecko-based HTML engine available in ABCpdf 8.
It is just one line of code to select the Gecko rendering engine (see the Doc.HtmlOptions.Engine property).
- How do I make my eForm fields savable using Acrobat Reader?
-
Acrobat Reader XI provides features to save eForms out of the box. Provided your clients are using this version of Acrobat they will be able to fill in and save standard PDF forms. The only problem you may have relates to older versions of Acrobat Reader which did not have this feature.
In Acrobat X and earlier, saving the contents of forms was something which Adobe regarded as an Acrobat Pro feature. However it was a key feature present in other rivals to PDF. As such Adobe allowed PDF documents to be created which contained special flags which enabled certain Acrobat Pro features in the free Acrobat Reader. Features like filling in and saving forms.
Adobe tightly restricted the way in which these documents could be created. Specifically these documents contained a signature based on a certificate issued by Adobe. Without such a certificate you could not create or modify these kinds of documents. Adobe are not generally issuing certificates to allow this type of signature to be created. We believe the only company outside Adobe to have one is SAP.
It is possible to create something similar to a form which is savable using older versions of Acrobat Reader. This is because Acrobat Reader allows you to save changes to annotations as long as they are not part of an eForm. So by removing the form fields from the eForm you can be left with a collection of savable annotations. From a technical point of view the document is no longer a form but from a user's point of view it may look like one.
doc.SetInfo(doc.Root, "/Perms:Del", ""); // make sure you have rights to do this
doc.SetInfo(doc.Root, "/AcroForm:Del", "");
Page[] pages = doc.ObjectSoup.Catalog.Pages.GetPageArray();
foreach (Page page in pages) {
Annotation[] annots = page.GetAnnotations();
foreach (Annotation annot in annots) {
StringAtom da = DictAtom.GetItem(annot.Atom, "DA") as StringAtom;
if (da == null) continue;
string ap = da.Text;
if (!ap.Contains(" 0 Tf")) continue;
double fontSize = annot.Rect.Height * 0.8;
da.Text = ap.Replace(" 0 Tf", String.Format(" {0:0.##} Tf", fontSize));
}
}
So why don't we have this as a feature in ABCpdf? Well Adobe have some of the best software engineers on the planet so it would seem to us that the fact that this feature exists means that it is intentional. It would seem inconceivable that this is an oversight. On the other hand the legal agreement for Acrobat Reader would appear to prohibit it being used for saving forms. But then this is not a PDF form. But then it might look like a form to an end user. EU law would appear to make it impossible to prohibit this type of operation. But not everyone is in the EU. There are a whole host of issues like this that are confusingly conflicted.
As such we do not feel that we want to make a judgment here. You need to look at the above code carefully and consider it in the context of the Adobe PDF Specification and the EULA for the version of Acrobat Reader you are targeting. At that point you can make an appropriate and informed decision based on your own use, position and legal advice.
- What does this error mean?
ABCpdf error '80131600'
Failed to add HTML: RPC to Gecko engine process failed. Exception was thrown in another thread: The directory name is invalid.
-
This error could occur under some circumstances in earlier versions of ABCpdf Version 10. The solution is to upgrade to the current release.
- I'm seeing occasional mysterious errors in MSHTML HTML conversion. These seem to be associated with events in the Application Event Log stating "Post operation taking an excessive time". What is causing this?
-
This is typically associated with Anti Virus (AV) apps intercepting HTML conversion and then failing or reducing the system to a crawl. This means that the results that ABCpdf is expecting, never return. Changing to a different AV app will normally solve the problem.
- When I use the ABCChrome HTML rendering engine I get "Unable to render HTML. ABCChrome has terminated unexpectedly. Status entrypoint not found." What does this mean?
-
This error message relates to missing functions in Windows DLLs. It is what you will see if the machine you are running on is not sufficiently up-to-date.
The ABCChrome HTML rendering engine requires Windows 2008 R2 / Windows 7 or later. It runs only on x64 systems.
The standard scenario associated with this type of message is related to deployment. Typically people develop on an up-to-date version of Windows. However then they may try deploying to an older one such as Windows 2008, at which point the issue would occur.
- I have a site running under Classic ASP. Around the 10th July 2018 I started getting an error "ActiveX component can't create object". Why?
-
Microsoft security update CVE-2018-8202 describes a situation in which,
"A local user can run a specially crafted application to exploit a flaw in the activation of COM objects and gain elevated privileges"
To be more specific,
An "elevation of privilege" vulnerability exists in .NET Framework that could allow an attacker to elevate their user rights level. To exploit the vulnerability, an attacker would first have to access the local computer, and then run a malicious program. This update addresses the vulnerability by correcting how .NET Framework enables COM objects.
Unfortunately the fix for this - released around the 10th July 2018 - has had the side effect of disabling calls to create objects under Classic ASP.
Our products use the standard methods that are built into .NET - ComVisible attributes and regasm.exe. So there is nothing unusual in our implementation and indeed we suspect this is affecting all .NET classes that expose COM interfaces.
The error reported is "ActiveX component can't create object" under Classic ASP at the call to CreateObject. So typically at the following point,
Set theDoc = Server.CreateObject("ABCpdf11.Doc")
This security update is contained a number of system updates including KB4338417, KB4340558, KB4338420 and KB4340559.
Backing out the update is one way to resolve the issue. Though without the update the system will remain vulnerable - you would need to establish if this is likely to be acceptable.
Alternatively you may wish to align your IIS and Web Site users which should also resolve the issue.
Classic ASP generally runs in the DefaultAppPool. The Identity setting for the pool should be ApplicationPoolIdentity. Assuming this is the case you just need to go to IIS and select your Web Site. Double click the "Authentication" icon. Right click on the "Anonymous Authentication" setting and select 'Edit'. Choose the "Application pool identity" radio button.