Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Import a File..

jshafer817jshafer817 Posts: 1Member
Hi.. Im a newb, but I was wondering if anyone would like to help me...

Im using this code to acquire a pdf image from a scanner, then an open file dialog box asks for the file. I would like to change this to automatically use the file image.pdf everytime..

Can anyone help me please please... I guess I need to read some more... but I dont really plan on programming my whole life.. All I want is this one thing.
------------------------------------------------------------------
TWAIN_SelectFeeder(1);
TWAIN_EnableDuplex(1);
TWAIN_SetPixelType(2);
TWAIN_SetLightPath(1);
TWAIN_SetXferCount(-1);
TWAIN_SetAutoScan(1);
TWAIN_SetMultiTransfer(1);
TWAIN_BeginMultipageFile("image.pdf");
OpenFileDialog openFileDialog=new OpenFileDialog();
openFileDialog.Multiselect=true;
if(openFileDialog.ShowDialog()!=DialogResult.OK) {
return;
}
string[] fileNames=openFileDialog.FileNames;
if(fileNames.Length<1){
return;
}
---------------------------------------------------
I know I need to use something like...
FileStream fs = File.Open("C:\image.pdf",FileMode.Open);
return;

And I dont know what to do with fileNames=openFileDialog.FileNames;

Comments

  • HackmanCHackmanC Posts: 441Member
    You didn't post what follow your code, but ...
    just comment or delete that code.
    [code][color=Blue]TWAIN_SelectFeeder[/color][color=Olive]([/color][color=Maroon]1[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_EnableDuplex[/color][color=Olive]([/color][color=Maroon]1[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_SetPixelType[/color][color=Olive]([/color][color=Maroon]2[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_SetLightPath[/color][color=Olive]([/color][color=Maroon]1[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_SetXferCount[/color][color=Olive]([/color][color=Gray]-[/color][color=Maroon]1[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_SetAutoScan[/color][color=Olive]([/color][color=Maroon]1[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_SetMultiTransfer[/color][color=Olive]([/color][color=Maroon]1[/color][color=Olive])[/color][color=Gray];
    [/color][color=Blue]TWAIN_BeginMultipageFile[/color][color=Olive]([/color][color=Darkred]"[/color][color=Red]image.pdf[/color][color=Darkred]"[/color][color=Olive])[/color][color=Gray];

    [/color][color=Orange]/*[/color][color=Orange] OpenFileDialog openFileDialog=new OpenFileDialog();
    openFileDialog.Multiselect=true;
    if(openFileDialog.ShowDialog()!=DialogResult.OK) {
    return;
    }
    string[] fileNames=openFileDialog.FileNames;
    if(fileNames.Length<1){
    return;
    } [/color][color=Orange]*/[/color][/code]
    Replace fileNames[0] with "C:\image.pdf" in your code.

    [red]Good luck![/red]
    [blue]Hackman[/blue]
Sign In or Register to comment.