after setting bookmark ,when I export its not showing any bookmark

  • Last Post 2 weeks ago
Ankit Kumar Sadangi posted this 2 weeks ago

 not showing any bookmark in the output file

IDocumentProcessingParams docProc=engine.CreateDocumentProcessingParams();




IFRPages frPages=document.getPages();

IParagraph para=frPages.Item(0).getLayout().getBlocks().Item(0).GetAsTextBlock().getText().getParagraphs().Item(0);

IWord word=para.getWords().Item(0);


para.SetBookmark(word.getFirstSymbolPosition(), para.getLength(), "Branch");


IPDFExportParams pdfParams = engine.CreatePDFExportParams();




String pdfExportPath = "D:\\DD-94-2040866\\OutputBOOKMARKSFIRSTWORD06_DD-94-2040866.pdf";


displayMessage( "Processing image..." ); 



IFRPages frPages1=document.getPages();

IParagraph para1=frPages.Item(0).getLayout().getBlocks().Item(0).GetAsTextBlock().getText().getParagraphs().Item(0) ;


displayMessage( "Saving image..." );

document.Export( pdfExportPath, FileExportFormatEnum.FEF_PDF, pdfParams);        

Order By: Standard | Newest | Votes
Oksana Serdyuk posted this 2 weeks ago

FineReader Engine 11 supports creation of bookmarks in PDF. However, these are not bookmarks in general (Adobe) sense. Bookmarks in Adobe sense are represented by a tree structure and they are displayed in a separate window in Adobe Acrobat. Bookmarks in FREngine sense are simple local hyperlinks. Our API allows to create local hyperlinks as follows:

1) Add a bookmark using the IParagraph::SetBookmark method.
2) Create a hyperlink using the IEngine::CreateHyperlink method and specify the HS_Local type for its scheme (IHyperlink::Scheme).
3) Set an address where the hyperlink points to via the IHyperlink::Target. It should be a name of a bookmark created in step 1.
4) Use the IParagraph::SetHyperlink method to add a hyperlink to a paragraph. 

For example, to add a bookmark for the first text block in a document the code will be the following in C#:


                // Recognize document
                displayMessage( "Recognizing..." );
                document.Process( null );

                // Add a bookmark to the first text block
                FREngine.Layout layout1 = engineLoader.Engine.CreateLayout();
                layout1 = document.Pages.Item(0).Layout;
                for (int i = 0; i < layout1.Blocks.Count; i++)
                    if (layout1.Blocks.Item(i).Type == FREngine.BlockTypeEnum.BT_Text)
                        FREngine.TextBlock block = layout1.Blocks.Item(i).GetAsTextBlock();
                        block.Text.Paragraphs.Item(0).SetBookmark(0, 5, "MyBookmark");
                        FREngine.Hyperlink hprLink = engineLoader.Engine.CreateHyperlink();
                        hprLink.Scheme = FREngine.HyperlinkSchemeEnum.HS_Local;
                        hprLink.Target = "MyBookmark";
                        block.Text.Paragraphs.Item(0).SetHyperlink(0, block.Text.Paragraphs.Item(0).Length, hprLink);

                // Save results
                displayMessage( "Saving results..." );

                // Save results to pdf using 'balanced' scenario
                FREngine.PDFExportParams pdfParams = engineLoader.Engine.CreatePDFExportParams();
                pdfParams.Scenario = FREngine.PDFExportScenarioEnum.PES_Balanced;
                document.Export( Path.Combine( FreConfig.GetSamplesFolder(), @"SampleImages\Demo.pdf" ),
                    FREngine.FileExportFormatEnum.FEF_PDF, pdfParams );


Ankit Kumar Sadangi posted this 2 weeks ago

Thanks for your reply