How to set Filter Index and Default Name for File SaveAs Dialog

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
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

How to set Filter Index and Default Name for File SaveAs Dialog

Post by RMan »

How would I specify what Filter Index and Filename to use for the Save As Dialog Box?

Basically I'm trying to add menu selections in to Save As Optimized, Save as PDF/A and such to specific locations (but prompt the user if they want to change it) so maybe I'm missing an easy way to do those functions with the SDK? From what I can tell we would have to use the cmd.saveAs command and set the default name and filter index in the dialog box.

I've tried intercepting the e_document_beforeSave event which allows me to change the filename but I can't get it to display the dialog box and it just saves the file without the dialog.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set Filter Index and Default Name for File SaveAs Dialog

Post by Sasha - Tracker Dev Team »

Hello RMan,

Can you please give a screenshot of what you mean exactly?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: How to set Filter Index and Default Name for File SaveAs Dialog

Post by RMan »

HEre you go. Basically we would like to issued the cmd.saveAs and then populate these two fields in the dialog box when it opens.

SaveAsDialog.jpg
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: How to set Filter Index and Default Name for File SaveAs Dialog

Post by RMan »

Any idea yet on how I can accomplish picking which File Type To Save as in the dialog?
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: How to set Filter Index and Default Name for File SaveAs Dialog

Post by Vasyl-Tracker Dev Team »

Hi RMan.

You may try to do it via intercepting the e.document.beforeSave:

Code: Select all

OnEvent(eventID, event ..)
{
	if (eventID == pxvInst.Std2ID("e.document.beforeSave"))
	{
		// to select the "Optimized PDF" type
 		event.DestConv = FindExportConvByID(pxvInst, "conv.optimized.pdf"); // uses pxvInst.GetFormatConverterIndex/ExportConverter[index]
		event.DestConvParams = pxvInst.GetFormatConverterParams(false, "conv.optimized.pdf");

		event.Doc.CoreDoc.SrcInfo.CustFileName = L"myTest.pdf"; // to show custom filename
	}
	else if (eventID == pxvInst.Std2ID("e.document.afterSave"))
	{
		event.Doc.CoreDoc.SrcInfo.CustFileName = L""; // to stop filename overriding
	}
}
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply