Error in IPXV_Document.Save

PDF-XChange Editor SDK for Developers

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

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.
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Error in IPXV_Document.Save

Post by jeffp »

Don't know why but this is throwing and error in Delphi. Am I not setting something right?

Code: Select all

procedure TMyPDFControl.SaveDoc(AFileName: String);
var
  destPath: IAFS_Name;
begin
  destPath := INST_AFS.DefaultFileSys.StringToName(PChar(AFileName), 0, nil);
  FControl.Inst.ActiveDocView.Doc.Save(destPath, 0, nil, nil, nil, nil, nil, 0);
  destPath := nil;
end;
Upon further testing, looks like the error was caused by passing the same filename. This one works.

Code: Select all

procedure TMyPDFControl.SaveDoc(AFileName: String);
var
  destPath: IAFS_Name;
begin
 destPath := nil;
  if not SameText(AFileName, FControl.Inst.ActiveDocView.Doc.CoreDoc.SrcInfo.ActualFileName) then
    destPath := INST_AFS.DefaultFileSys.StringToName(PChar(AFileName), 0, nil);

  FControl.Inst.ActiveDocView.Doc.Save(destPath, 0, nil, nil, nil, nil, nil, 0);
  destPath := nil;
end;
However, if I save with a different filename, it doesn't seem to update the SrcInfo items and the document tab name does not change. How can I get the Active Doc to use the info in the new saved name?
Sasha - PDF-XChange
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Error in IPXV_Document.Save

Post by Sasha - PDF-XChange »

Hello Jeff,

If you want to save the current document, try passing NULL as the first value as it's written in the documentation:
https://sdkhelp.pdf-xchange.com/vie ... ument_Save

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ