1. Olan Knight
  2. PowerBuilder
  3. Wednesday, 7 September 2022 23:51 PM UTC

PB2019R3
Windows 10, 64 bit platform


Here's how I declare the file to be opened; ls_path = "Q:\CABSv4\PDF_Notices"

    // Change to the target folder
    ls_current = GetCurrentDirectory ()
    
    ll_rc = ChangeDirectory (ls_path)
    
    
    // ================================================================
    // If we have a PDF Notice then we have to use a temporary filename
    // for the invoice. This is because the final invoice needs to have
    // the PDF Notice MERGED with the invoice file, and our tool PDFtk
    // does not allow the final output file to be the name of either
    // input file.
    // ================================================================
    IF (ls_notice_type = 'P') THEN
        
        // Save the final invoice path & file
        ls_final_pdf_filename = ls_final_path + ls_invoice_filename + ".pdf"
        
        // Set the temp invoice filename
        ls_invoice_filename = ls_path + ls_invoice_filename + "_temp.pdf"
        
        lb_valid = FileExists (ls_invoice_filename)
        IF (lb_valid) THEN
            lb_valid = FileDelete (ls_invoice_filename)
        END IF
        
    END IF
    // ------------------------------------------------------------------    
    

    // OKnight, 22-APR-2005.  TD #64. Added "ls_ban" to the job name. 
    // ls_invoice_filename = "Q:\CABSv4\PDF_Notices\035H-035HD0222E-D0222E220907_temp.pdf
    il_PrintJobId = PrintOpen (ls_invoice_filename)        

<.....  code happens  ....>  


// At this point ls_path and ls_invoice_filename have not changed
    ll_rc = PrintClose(il_PrintJobId)

And the file is created in "C:\Personal\Test" !!!!!!!!!!

How can I get the file created in the folder I specified?
What controls the location of the file?

FYI:  The current printer has a default folder of "C:\Personal\Test", but I thought the location of the file was controlled by the PrintJobName parameter of the FileOpen () function. Changing the default folder of the printer changes the location where the FileClose() function creates the file. I'm guessing that the folder used by the FileOpen/FileCLose functions is in a Windows Registry setting.


Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 8 September 2022 00:17 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Olan;

  The PrintOpen() command only uses the 1st argument to display the printer job name in the MS-Windows "Print Manager". That is so the App user can monitor the print jobs status, restart, prioritize or cancel the print job (if the 2nd argument is TRUE) if required.

  The location of the print spool file itself is controlled by the O/S print manager and the target printer's driver. This is outside of any normal Windows App's control or knowledge.

Regards ... Chris

Comment
  1. Olan Knight
  2. Thursday, 8 September 2022 15:56 PM UTC
Thanks, Chris!
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.