The GetWarningLevel and DocGetWarningLevel methods are used to read any warnings generated when opening a document. The warnings are related to features not supported by the PDF Converter.
System.Integer GetWarningLevel()
int DocGetWarningLevel(EXTDOCHANDLE edhDocument, int* warningLevel)
edhDocument
Handle Returned by DocOpen.
warningLevel
Value of the warning.
Flag |
Value (Hex) |
Value (Dec) |
Description |
---|---|---|---|
PDF_WRN_SEVERE |
0x80000000 |
-2147483648 |
Indicates a severe condition that should not be ignored. This flag is combined with one of the following flags. |
PDF_WRN_LZW |
0x00000001 |
1 |
PDF document contains LZW compression(Obsolete as of version 2). |
PDF_WRN_CANNOT_EXTRACT_FONT |
0x00000002 |
2 |
Document contains a font that was not extracted properly. |
PDF_WRN_CANNOT_EXTRACT_IMAGE |
0x00000004 |
4 |
Document contains an image that was not extracted properly. |
PDF_WRN_UNSUPPORTED_COLORSPACE |
0x00000008 |
8 |
Unsupported color-space, will result in some color distortion. |
PDF_WRN_SIGNATURE_NOT_RECOGNIZED |
0x00000010 |
16 |
Document contains a digital signature that the PDF Creator could not recognize. |
PDF_WRN_SIGNATURE_NOT_VALID |
0x00000020 |
32 |
Document contains a digital signature that the PDF Creator could not validate. |
PDF_WRN_CANNOT_READ_PDFCREATOR_CONTENT |
0x00000400 |
1024 |
PDF file contains Amyuni custom design information that was ignored during load. |
PDF_WRN_ERROR_READING_DOCUMENT |
0x00000800 |
2048 |
General error while loading document, check the error log for more details. |
PDF_WRN_NEW_XREF_FORMAT |
0x00001000 |
4096 |
PDF file uses the compressed XRef file format which is not compatible with versions earlier than 4 and with some external tools such as search engines. |
PDF_WRN_CANNOT_FIND_FONT_CMAP |
0x00002000 |
8192 |
PDF file contains a font that required an external character map. |
PDF_WRN_FILE_NOT_FOUND |
0x00004000 |
16384 |
Filename passed as parameter to Open or OpenEx is not found. |
PDF_WRN_XFA_NOT_SUPPORTED |
0x00008000 |
32768 |
File contains XFA forms, some elements might be missing when rendering the file. |
PDF_WRN_PDFCONTENT_OPERAND_OPERATOR_MISMATCH |
0x00040000 |
262144 |
Encountered operator with wrong number of arguments in page stream. |
PDF_WRN_INVALID_DATA_BEFORE_HEADER (* added in version 5.5.1.5) |
0x00080000 |
524288 |
Invalid data encountered and ignored before the %PDF tag. |
Member of CDIntfEx.Document.
Public Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Converter Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
' Declare a new cdintfex document if it does not exist in the form.
Dim pdfDoc As New CDIntfEx.Document
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode)
' Open the document
pdfDoc.Open("c:\temp\test.pdf")
' Check for errors
Dim warningLevel as Integer = pdfDoc.GetWarningLevel()
Console.WriteLine(warningLevel)
' Save the document
pdfDoc.Save("c:\temp\result.pdf")
warningLevel = pdfDoc.GetWarningLevel()
Console.WriteLine(warningLevel)
End Sub
public void AutoBookmarks()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Converter Evaluation";
const string strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
// Declare a new cdintfex document if it does not exist in the form.
CDIntfEx.Document pdfDoc = new CDIntfEx.Document();
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
pdfDoc.SetLicenseKey(strLicenseTo, strActivationCode);
// Open the document
pdfDoc.Open(@"c:\temp\test.pdf");
// Check for errors
int warningLevel = pdfDoc.GetWarningLevel();
Console.WriteLine(warningLevel);
// Save the document
pdfDoc.Save(@"c:\temp\result.pdf");
warningLevel = pdfDoc.GetWarningLevel();
Console.WriteLine(warningLevel);
}
// PDF Converter Cpp.cpp : Defines the entry point for the console application.
//
#include <Windows.h>
#include <string>
#include "CdIntf.h"
#pragma comment (lib, "CDIntf.lib")
using namespace std;
int main()
{
// Constants for Activation codes
#define strLicenseTo "Amyuni PDF Converter Evaluation"
#define strActivationCode "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
// Declare a new cdintfEx document if it does not exist in the form.
EXTDOCHANDLE pdfDoc;
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
SetLicenseKeyA(strLicenseTo, strActivationCode);
// Open the document
const LPBYTE password = nullptr;
DocOpenA(&pdfDoc, "c:\\temp\\test.pdf", password);
// Check for errors
int* warningLevel = nullptr;
DocGetWarningLevel(&pdfDoc, warningLevel);
MessageBox(nullptr, LPCSTR(&warningLevel), LPCSTR("PDF Warnings"), MB_OK | MB_ICONWARNING );
// Save the document
DocSaveA(pdfDoc, "c:\\temp\\result.pdf");
DocGetWarningLevel(&pdfDoc, warningLevel);
MessageBox(nullptr, LPCSTR(&warningLevel), LPCSTR("PDF Warnings"), MB_OK | MB_ICONWARNING );
// Destroy pdfDoc object
DocClose(pdfDoc);
pdfDoc = nullptr;
return 0;
}
package Example;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Sample {
public static void main(String[] args)
{
// Constants for Activation codes
String strLicenseTo = "Amyuni PDF Converter Evaluation";
String strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA";
// Declare a new cdintfex document if it does not exist in the form.
ActiveXComponent pdfDoc = new ActiveXComponent("CDIntfEx.Document.6.5");
// The SetLicenseKey method should be called after creating an object of type
// CDIntfEx.Document to activate the advanced methods that require the object
// activation code to work properly
Dispatch.call(pdfDoc, "SetLicenseKey", strLicenseTo, strActivationCode);
// Open the document
Dispatch.call(pdfDoc, "Open", "c:\\temp\\test.pdf");
// Check for errors
Variant message = Dispatch.call(pdf,"GetWarningLevel");
System.out.println(message);
// Save the document
Dispatch.call(pdfDoc, "Save", "c:\\temp\\result.pdf");
message = Dispatch.call(pdf,"GetWarningLevel");
System.out.println(message);
// Destroy pdfDoc object
pdfDoc = null;
}
}
# Constants for Activation codes
$strLicenseTo = "Amyuni PDF Converter Evaluation"
$strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
# Declare a new cdintfex document if it does not exist in the form.
$pdfDoc = New-Object -ComObject CDIntfEx.Document.6.5
# The SetLicenseKey method should be called after creating an object of type
# CDIntfEx.Document to activate the advanced methods that require the object
# activation code to work properly
[System.__ComObject].InvokeMember('SetLicenseKey', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc, @($strLicenseTo, $strActivationCode))
# Open the document
[System.__ComObject].InvokeMember('Open', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\test.pdf")
# Check for errors
[System.__ComObject].InvokeMember('GetWarningLevel', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,$null)
# Save the document
[System.__ComObject].InvokeMember('Save', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,"c:\temp\result.pdf")
[System.__ComObject].InvokeMember('GetWarningLevel', [System.Reflection.BindingFlags]::InvokeMethod,$null,$pdfDoc,$null)
# Destroy pdfDoc object
$pdfDoc = $null
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Converter Evaluation"
Const strActivationCode = "07EFCDAB0100010025AFF1801CB9441306C5739F7D452154D8833B9CECBA2ADE79E3762A69FFC354528A5F4A5811BE3204A0A439F5BA"
' Declare a new Document object
Dim pdfDoc
Set pdfDoc = CreateObject("CDIntfEx.Document.6.5")
' The SetLicenseKey method should be called after creating an object of type
' CDIntfEx.Document to activate the advanced methods that require the object
' activation code to work properly
pdfDoc.SetLicenseKey strLicenseTo, strActivationCode
' Open the document
pdfDoc.Open "c:\temp\test.pdf"
' Check for errors
Dim warningLevel
warningLevel = pdfDoc.GetWarningLevel
WScript.Echo(warningLevel)
' modified
pdfDoc.Modified = True
' Save the document
pdfDoc.Save "c:\temp\result.pdf"
warningLevel = pdfDoc.GetWarningLevel
WScript.Echo(warningLevel)
' Destroy pdfDoc object
Set pdfDoc = Nothing