Foxit Developer Blog

    Insights, tutorials, and updates from the Foxit PDF SDK engineering team.

    Foxit PDF SDK 5.3

    How to render only part of a PDF page?

    To render only part of a PDF page, the key point is to ensure that the rendering page size is larger than the device’s display area. Contents that are not on the display area will not be rendered. Foxit PDF SDK provides the interface FSPDF_Page_GetMatrix to get page’s transformation matrix which can be used for [...]

    Read Article
    Foxit WebPDF Viewer - Discontinued

    Why Eclipse reports “The method getTextContent() is undefined” always in org.w3c.dom.Node class when running webpdf-extension-sample project?

    The project uses dom4j->xml-apis, it calls node class from dom4j but not from JDK. So it reports node class error. To solve the problem, right click properties of the project, select builder path, and then move the JDK up to maven dependencies, it will call the node class from JDK. The error will disappear. Note: [...]

    Read Article
    Foxit PDF SDK 5.3

    Why the length of the string retrieved from interface FSPDF_TextPage_GetChars is different from the count of characters getting from interface FSPDF_TextPage_CountChars?

    The string retrieved from interface FSPDF_TextPage_GetChars is a UTF-8 string. The interface FSPDF_TextPage_CountChars gets the count of characters in a page. “The length of string” and “the count of characters” are two totally different concepts. The length of a UTF-8 string represents how many bytes the UTF-8 string consumes, rather than how many characters the [...]

    Read Article
    Foxit PDF SDK 5.3

    Why can’t I get the desired filling color if the bitmap format is not ARGB or RGB or if the bitmap contains alpha channel when using the interface FSCRT_Bitmap_FillRect?

    Before SDK 4.4 version, there exist two bugs when using the interface FSCRT_Bitmap_FillRect to fill a bitmap object with a specified color. FSCRT_Bitmap_FillRect just only receives the color format of ARGB, but it does not judge the format of the bitmap and treats all bitmap formats as ARGB. So, users cannot get the desired filling [...]

    Read Article
    Foxit PDF SDK 5.3

    How can I display fonts correctly?

    Foxit PDF SDK provides the interface of FSCRT_Library_AddFontFile or FSCRT_Library_SetFontMapperHandler to display fonts. Following is a sample to show how to use FSCRT_Library_SetFontMapperHandler in C++. static FSCRT_FONTMAPPERHANDLER ExternalFontMapper; static string FallbackFontPath; // MapExternalFont function will be triggered when an external font is needed. static FS_RESULT MapExternalFont(FS_LPVOID clientData, FS_LPCSTR fontName, FS_DWORD fontStyles, FS_INT32 weight, FS_INT32 charset, [...]

    Read Article
    Foxit PDF SDK 5.3

    What is the role of the interface FSPDF_Doc_InitiateJavaScript? And why would it destroy the form actions when calling the interface FSPDF_Doc_InitiateJavaScript before FSPDF_Doc_SetActionHandler?

    FSPDF_Doc_InitiateJavaScript is mainly used for initiating javascript, such as a series of javascript functions and global variables that are stated by users. When opening a document, we should call this interface to initiate javascript, which may generate other actions that need support from external application. So the interface FSPDF_Doc_InitiateJavaScript should be called after FSPDF_Doc_SetActionHandler. Otherwise, [...]

    Read Article
    Foxit PDF SDK 5.3

    What is the relationship between FSPDF_FORM and FSPDF_FORMCONTROL? What about FSPDF_FORMCONTROL and FSCRT_ANNOT?

    One PDF Form (FSPDF_FORM) can contain more than one Form Field, and one Form Field can contain more than one Form Control (FSPDF_ FORMCONTROL). Form Control (FSPDF_ FORMCONTROL) and Annotation (FSCRT_ANNOT) belong to the type of “annotation”. The difference is that FSPDF_ FORMCONTROL denotes the “widget” annotations, and FSCRT_ANNOT denotes other annotations which are not [...]

    Read Article
    Foxit PDF SDK 5.3

    How can I print layers which are supposed only to be printed but not displayed?

    Foxit PDF SDK provides parameter setting to control printing. We can set the parameter “flag” in the interface FSPDF_RenderContext_SetFlags(FSPDF_RENDERCONTEXT pdfRenderContext, FS_DWORD flags) to “FSPDF_RENDERCONTEXTFLAG_OCGPRINT” to print the layers as intended. Note: This article refers to a deprecated version of a Foxit Product. If you are still using Foxit PDF SDK 5.3 or older, please refer [...]

    Read Article
    Foxit PDF SDK 5.3

    How can I add an object to FormXObject?

    FormXObject is one kind of PageObject. So we can call the interface FSPDF_PageObjects_InsertObject to add an object to FormXObject. Note: This article refers to a deprecated version of a Foxit Product. If you are still using Foxit PDF SDK 5.3 or older, please refer to your download package documents for Developer Guide and API Reference. [...]

    Read Article
    Foxit PDF SDK 5.3

    After creating a new FreeText annotation, I called FSPDF_Annot_SetContents to set its contents, and then called FSPDF_Annot_ResetAppearance. But why are the contents not displayed?

    For a FreeText annotation, it’s necessary to set its default appearance (DA). Calling the interface FSPDF_Annot_SetDefaultAppearance is needed for this task. Usually, we suggest setting up at least FSPDF_DEFAULTAPPEARANCE::font and FSPDF_DEFAULTAPPEARANCE::fontSize, while setting the value of FSPDF_DEFAULTAPPEARANCE::flags to FSPDF_DEFAULTAPPEARANCE_FONT. Note: This article refers to a deprecated version of a Foxit Product. If you are still [...]

    Read Article