If I open a file at location c:\test\file1.pdf
The Doc.DocCore.SrcInfo.ActualFileName shows c:\test\file1.pdf
Then if I change Doc.DocCore.SrcInfo.CustFileName to c:\test\file2.pdf
that changes the Doc.DocCore.SrcInfo.CustFileName and Doc.DocCore.SrcInfo.ActualFileName to c:\test\file2.pdf. So far so good.
However, if I then press the Save button on the Editor UI it saves the document to the original location of c:\test\file1.pdf even though ActuaFileName and CustFileName says c:\test\file2.pdf.
How can I open c:\test\file1.pdf, then make a change to SrcInfo and cause of Save button click to save the file to c:\test\file2.pdf?
Thanks.
--Jeff
Saving using CustFileName
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.
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.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Saving using CustFileName
Hello Jeff,
Can you please describe what you need with more details, because it's probably much easier to achieve what you need via the Editor Level?
Cheers,
Alex
Can you please describe what you need with more details, because it's probably much easier to achieve what you need via the Editor Level?
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 914
- Joined: Wed Sep 30, 2009 6:53 pm
Re: Saving using CustFileName
I need to be able to open a PDF in the Editor either via the UI or code, and then change a property so that the save button in the Editor will save it to a different location that I set.
The reason for this is that I am running an outside OCR process here. So my steps are as follows.
1. I open a PDF file
2. I save the PDF file to a temp location.
3. I run an outside OCR on the temp file which embeds it with ocr text.
4. I then quickly close the original file and open the temp file
5. I know what a save command in the Editor to save the opened temp file to the original file's location.
The old ViewerAX allowed this by setting the DispFileName property.
The reason for this is that I am running an outside OCR process here. So my steps are as follows.
1. I open a PDF file
2. I save the PDF file to a temp location.
3. I run an outside OCR on the temp file which embeds it with ocr text.
4. I then quickly close the original file and open the temp file
5. I know what a save command in the Editor to save the opened temp file to the original file's location.
The old ViewerAX allowed this by setting the DispFileName property.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
Re: Saving using CustFileName
Hello Jeff,
Probably this topic should help:
https://forum.pdf-xchange.com/ ... 66&t=25808
Cheers,
Alex
Probably this topic should help:
https://forum.pdf-xchange.com/ ... 66&t=25808
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 221
- Joined: Tue Jul 02, 2013 10:06 pm
Re: Saving using CustFileName
Is it true that even in the latest release if we set the SrcInfo.CustFileName that we still have to jump through hoops in using events and such to have it actually save to that filename? Or is there another property or method I'm missing to say create a blank document (or open a new one) and set the name that it should be saved as when the user tries to save it?
In all of the SDK's and even your old ones this is seldom the case and once you change a filename then the program or SDK itself would actually try to save it as that name. It's so much cleaner that way than having to have every programmer write the same code basically to handle it.
In all of the SDK's and even your old ones this is seldom the case and once you change a filename then the program or SDK itself would actually try to save it as that name. It's so much cleaner that way than having to have every programmer write the same code basically to handle it.
-
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Saving using CustFileName
Hi Jeff.
In Editor SDK the changing of SrcInfo.CustFileName takes effect only on UI, it can be used just for displaying document's name/location.
However, if you need to change the logic of doc.Save feature - you need to handle the "e.document.beforeSave" event:
Unfortunately, currently isn't easy to handle this event globally, from the pdfCtl.Inst.EventServer, because IPXV_DocSaveEvent doesn't tell about the document that is trying to save itself. In the near future we will add the simple Doc property to the IPXV_DocSaveEvent event to simplify this moment of usage.
HTH.
In Editor SDK the changing of SrcInfo.CustFileName takes effect only on UI, it can be used just for displaying document's name/location.
However, if you need to change the logic of doc.Save feature - you need to handle the "e.document.beforeSave" event:
Code: Select all
int id_e_document_beforeSave = pdfCtl.Inst.Str2ID("e.document.beforeSave");
...
DocEventsHandler deh = new DocEventsHandler(doc);
doc.EventServer.RegisterEventHandler(id_e_document_beforeSave , deh, 0);
...
DocEventsHandler::OnEvent(eventId, event)
{
if (eventId == id_e_document_beforeSave)
{
IPXV_DocSaveEvent e = (IPXV_DocSaveEvent)event;
IAFS_Name dest;
afsInst.DefaultFileSys.StringToName(m_doc.DocCore.SrcInfo.ActualFileName, 0, 0, &dest);
e.Dest = dest;
e.DestFS = afsInst.DefaultFileSys;
e.Flags = (e.Flags & ~PXV_DocSave_Copy) | PXV_DocSave_SwitchToDest;
e.Handled = true;
}
}
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.
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.