bookmark export to text file

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

bookmark export to text file

Post by jusWest »

Hello!

I'm using op.bookmarks.export, to export bookmarks now, but need to export to a textfile also.

I see the editor has a export to textfile function, is this also available in the Editor SDK?

Regards
Ronny
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: bookmark export to text file

Post by Sasha - Tracker Dev Team »

Hello Ronny,

For this one you should use the Bookmarks Plugin. Here's a sample on how to use the operation (I'm afraid that there is no documentation for this one as this is a plugin operation, but the sample is pretty straightforward):

Code: Select all

private void BookmarksToTextFile(PDFXEdit.IPXC_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.bookmarks.toTextFile", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	var input = Op.Params.Root["Input"];
	input.Add().v = Doc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["FilePath"].v = "D:\\";
	options["FileName"].v = "Bookmarks.txt";
	//enum eBTTFlags //bookmarks to text file
	//{
	//	//sheet "Select Bookmarks and output params"
	//	ebttf_Default = 0x0000000,
	//	ebttf_ExportSelected = 0x0000001,
	//	ebttf_ExportCertainActType = 0x0000002,
	//	ebttf_ExportActTypesAll = 0x0000004,
	//	ebttf_ExportActType_Page = 0x0000008,
	//	ebttf_ExportActType_Launch = 0x0000010, //open document
	//	ebttf_ExportActType_GotoR = 0x0000020, //open document
	//	ebttf_ExportActType_URI = 0x0000040,
	//	ebttf_ExportActType_JS = 0x0000080,

	//	ebttf_CustomFilename = 0x0000100,
	//	ebttf_DoNotOverwriteExistingFiles = 0x0000200,
	//	ebttf_OpenContFolder = 0x0000400,
	//	ebttf_IncludeSubBookmarks = 0x0000800,

	//	ebttf_SelectBookmarksAndOutputFlags = 0x000FFFF,

	//	//sheet "Select bookmark props to export"
	//	ebttf_fDoNotExpActions = 0x0010000,
	//	ebttf_fDoNotExpPagesText = 0x0020000,
	//	ebttf_fDoNotResolveNamedDests = 0x0040000,
	//	ebttf_fUseDetailedDescr = 0x0080000,
	//	ebttf_fExpWebLinksText = 0x0100000,
	//	ebttf_fExpOpenFileText = 0x0200000,
	//	ebttf_fExpGotoRText = 0x0400000,
	//	ebttf_fExpJavascriptText = 0x0800000,
	//	ebttf_fExpTextStyleAndColor = 0x1000000,
	//	ebttf_fExpBkmrkClosedState = 0x2000000,
	//	ebttf_DoNotEscapeServiceSymbols = 0x4000000,

	//	ebttf_BookmarkExportPropsFlags = 0xFFFF0000,
	//};
	options["Flags"].v = 0x0000004 | 0x0000100;
	options["Separator"].v = ';';
	Inst.AsyncDoAndWaitForFinish(Op);
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: bookmark export to text file

Post by jusWest »

Hello!

Is there also a "op.bookmarks.fromTextFile" function in the plugin?

Would be nice to import bookmarks from text files too :)
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: bookmark export to text file

Post by jusWest »

I have tried this:

Code: Select all

                int nID = _Inst.Str2ID("op.bookmarks.fromTextFile", false);
                IOperation Op = _Inst.CreateOp(nID);
                ICabNode input = Op.Params.Root["Input"];
                input.v = _Doc;
                ICabNode options = Op.Params.Root["Options"];
                IAFS_Inst fsInst = (IAFS_Inst)_Inst.GetExtension("AFS");
                IAFS_Name impPath = fsInst.DefaultFileSys.StringToName(importFileName);
                options["ImportSource"].v = impPath;
                Op.Do();
nID gets a value, so the function seems to exist, but it dos nopt work, so maybee I have my paramters and input wrong?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: bookmark export to text file

Post by Sasha - Tracker Dev Team »

Hello jusWest,

Here's a working sample for this one:

Code: Select all

private void BookmarksFromTextFile(PDFXEdit.IPXC_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	int nID = Inst.Str2ID("op.bookmarks.fromTextFile", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	var input = Op.Params.Root["Input"];
	input.v = Doc;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["FileName"].v = "D:\\Bookmarks.txt";
	options["Separator"].v = ';';
	options["ActionSeparator"].v = ',';
	Inst.AsyncDoAndWaitForFinish(Op);
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: bookmark export to text file

Post by jusWest »

Ahh, great, thank you!

Just one aditional question, given this enum:

Code: Select all

    public enum eBTTFlags //bookmarks to text file
    {
        //sheet "Select Bookmarks and output params"
        ebttf_Default = 0x0000000,
        ebttf_ExportSelected = 0x0000001,
        ebttf_ExportCertainActType = 0x0000002,
        ebttf_ExportActTypesAll = 0x0000004,
        ebttf_ExportActType_Page = 0x0000008,
        ebttf_ExportActType_Launch = 0x0000010, //open document
        ebttf_ExportActType_GotoR = 0x0000020, //open document
        ebttf_ExportActType_URI = 0x0000040,
        ebttf_ExportActType_JS = 0x0000080,

        ebttf_CustomFilename = 0x0000100,
        ebttf_DoNotOverwriteExistingFiles = 0x0000200,
        ebttf_OpenContFolder = 0x0000400,
        ebttf_IncludeSubBookmarks = 0x0000800,

        ebttf_SelectBookmarksAndOutputFlags = 0x000FFFF,

        //sheet "Select bookmark props to export"
        ebttf_fDoNotExpActions = 0x0010000,
        ebttf_fDoNotExpPagesText = 0x0020000,
        ebttf_fDoNotResolveNamedDests = 0x0040000,
        ebttf_fUseDetailedDescr = 0x0080000,
        ebttf_fExpWebLinksText = 0x0100000,
        ebttf_fExpOpenFileText = 0x0200000,
        ebttf_fExpGotoRText = 0x0400000,
        ebttf_fExpJavascriptText = 0x0800000,
        ebttf_fExpTextStyleAndColor = 0x1000000,
        ebttf_fExpBkmrkClosedState = 0x2000000,
        ebttf_DoNotEscapeServiceSymbols = 0x4000000,

        //ebttf_BookmarkExportPropsFlags = 0xFFFF0000
    };
I am trying to use thees flags to get this kind of output to the textfile:

Code: Select all

Page 1; goto:{11; XYZ; 12; 0.000; 844.000}
But I only get something like this:

Code: Select all

Page 1; 11
Which flag to use?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: bookmark export to text file

Post by Sasha - Tracker Dev Team »

Hello jusWest,

Can you obtain such an output from the End-User Editor?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: bookmark export to text file

Post by jusWest »

Yes, see attached image, if this is enabled, the desired output happens
Attachments
bmexport.PNG
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: bookmark export to text file

Post by Sasha - Tracker Dev Team »

Hello jusWest,

This flag looks like what you need:
ebttf_fUseDetailedDescr

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: bookmark export to text file

Post by jusWest »

yop, that worked, thanks!
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: bookmark export to text file

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply