Op.ScanToImages Issue

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

Op.ScanToImages Issue

Post by jeffp »

I'm using the code below in Delphi to scan a document. This code launches the scanner in which the pages are pulled through the scanner. But I have two issues:

First, with the code below I don't get a resulting output file. I want to produce a file on the file system with the scanned images.

Second, instead of one output file, how can I produce a singe TIF file for every page of the scanned document. This is my preferred scenario. Do I need to hook up an Event? If so how?

Code: Select all

procedure TMyPDF.ScanToImages(AScannerName, AOutputFile: String);
var
  nID: integer;
  pOp: IOperation;
  output: ICabNode;
  options: ICabNode;
  imgPath: IAFS_Name;
begin
  nID := INST_PXV.Str2ID('op.scanToImages', False);
  pOp := INST_PXV.CreateOp(nID);

  options := pOp.Params.Root['Options'];

  options['ScannerName'].v := AScannerName;
  options['ShowNativeUI'].v := false;
  options['DataTransferMethod'].v := 0;

  imgPath := INST_AFS.DefaultFileSys.StringToName(PChar(AOutputFile), 0, nil);
  output := pOp.Params.Root['Output'];
  output.Add(dt_IUnknown).v := imgPath;

  pOp.Do_(0);
end;
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 12880
Joined: Wed Jan 03, 2018 6:52 pm

Re: Op.ScanToImages Issue

Post by Daniel - PDF-XChange »

Hello, jeffp

I have passed this up to the Dev team, hopefully we can get a reply in the next few days.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
[email protected]
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: Op.ScanToImages Issue

Post by jeffp »

Thanks
User avatar
Alex - PDF-XChange
User
Posts: 39
Joined: Mon Nov 04, 2013 9:33 am

Re: Op.ScanToImages Issue

Post by Alex - PDF-XChange »

Hello, jeffp
Output is where the operation returns its results. In case of op.scanToImages it will be an array of file names (IAFS_Name). Hope this helps.
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: Op.ScanToImages Issue

Post by jeffp »

Two questions:

(1) Is there in any sample code that shows me how to setup Output as an array of file names (IAFS_Name)

(2) Is there anyway to get each page in a multipage scan written to file as each page finishes rather than waiting for the entire scan to complete?
User avatar
Alex - PDF-XChange
User
Posts: 39
Joined: Mon Nov 04, 2013 9:33 am

Re: Op.ScanToImages Issue

Post by Alex - PDF-XChange »

(1) There should be no need for any setup; simply read the names from the output once the operation is complete.
(2) Unfortunately, there is no way to do that; you can only read the output after the operation is complete.
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: Op.ScanToImages Issue

Post by jeffp »

Do any Events fire while scanning like after each page of a scan?
User avatar
Alex - PDF-XChange
User
Posts: 39
Joined: Mon Nov 04, 2013 9:33 am

Re: Op.ScanToImages Issue

Post by Alex - PDF-XChange »

No such events for now.