Is it possible to put file names from a PB program when you choose to print to a PDF file?
Google gave me no help.
Google gave me no help.
#COMPILE EXE #DIM ALL FUNCTION PBMAIN() LOCAL JobName AS STRING JobName = "MyJob" 'this is the name of the print job ' Print to printer XPRINT ATTACH CHOOSE USING %PD_PRINTTOFILE, JobName XPRINT SET ORIENTATION 2 XPRINT RENDER "photo.bmp", (0, 0) - (2422 * 2, 1864 * 2) XPRINT CLOSE END FUNCTION
' Windows 10 #Compile Exe #Dim All #Include "win32api.inc" Declare Function PostThreadMessage Lib "USER32.DLL" Alias "PostThreadMessageA" (ByVal idThread As Dword, ByVal uMsg As Dword, ByVal wParam As Dword, ByVal lParam As Long) As Long Sub SendText(hWnd As Dword, sText As WString) Local tinp As INPUTAPI Local i As Long Local wszText As WStringZ * %Max_Path SetForegroundWindow hWnd Sleep 20 wszText = sText tinp.dtype = %INPUT_KEYBOARD tinp.iki.wVk = 0 For i = 1 To Len(wszText) tinp.iki.dwFlags = %KEYEVENTF_UNICODE tinp.iki.wScan = Asc(Mid$(wszText, i, 1)) SendInput 1, ByVal VarPtr(tinp), SizeOf(tinp) tinp.iki.dwFlags = %KEYEVENTF_UNICODE Or %KEYEVENTF_KEYUP SendInput 1, ByVal VarPtr(tinp), SizeOf(tinp) Next i End Sub '------------------/SendText Thread Function TimerThread(ByVal dwVar As Dword) As Long Static TimerID As Dword Local Msg As TAGMSG ' Start the timer TimerID = SetTimer(%NULL, %NULL, 500, CodePtr(TimerProc)) ' Post %WM_TIMER msg to TimerProc every 500 msec ' Loop passes msg on to TimerProc until.. While GetMessage(Msg, %NULL, %NULL, %NULL) <> 0 ' %WM_QUIT causes GetMessage to return '0' DispatchMessage Msg ' DispatchMessage passes %WM_TIMER on to TimerProc. Wend KillTimer %NULL, TimerID ' Kill the timer WinBeep 300,500 End Function '------------------/TimerThread Sub TimerProc(ByVal hWnd As Dword, ByVal uMsg As Long, ByVal TimerID As Long, ByVal dwTime As Dword) Static TimerCount As Long Local hMSPDF As Dword Select Case uMsg Case %WM_Timer ' Timer has 'fired' Incr TimerCount ' WinBeep 500,200 If hMSPDF = 0 Then hMSPDF = FindWindow("#32770", "Save Print Output As") If hMSPDF Then SendText hMSPDF, "NewPrintJob" ' + $CRLF PostThreadMessage GetCurrentThreadID, %WM_Quit, 0, 0 End If End If If TimerCount = 10 Then ' Bail out after n intervals PostThreadMessage (GetCurrentThreadID, %WM_Quit, 0, 0) ' Signal Quit to Msg Loop End If End Select End Sub '------------------/TimerProc Function PBMain Local sTemp As String Local hThread, dwVar As Dword Thread Create TimerThread(dwVar) To hThread ' Create monitor thread just before XPRINT Statements Thread Close hThread To hThread ' Release thread handle - not used here XPrint Attach "Microsoft Print To PDF", "JobName2" ' JobName$ not recieved by MS Prnt 2 PDF Dialog ' XPRINT ATTACH "CutePDF Writer" ', "JobName2" ' Ok with PDFCreator and CutePDF Writer XPrint "hi there gang" XPrint Close Do: Sleep 50: Loop Until ThreadCount = 1 ' ? "Done" End Function '------------------/PBMain
OPEN any_file_name FOR OUTPUT as hFile {programming library commands to create a PDF file go here } CLOSE hFile
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment