Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing PDF Files

Status
Not open for further replies.

ielite

Technical User
Mar 21, 2005
1
US
I am using Delphi 7.0 /ADO/MS Access DB.


I need to print some Adobe Acrobat files, which the path to resides in
a database field. Each files uses the same path, just different file
name.


I Then use the following to print:


ShellExecute( 0, 'print', PAnsiChar(PDFPath + '\' +
frmData.tblParents.FieldByName­('File').asString), nil, nil, SW_NORMAL);


to print the files. Which seems to work great when sent to a local
printer. However, to print to a network printer, I sometimes miss some
of the children, or the parent for that matter.


Any help on this would be greatly appreciated!


See entire code below:


procedure TfrmMain.btnPrintParentClick(S­ender: TObject);
var
PrintChildren: Boolean;
begin
if FileExists(PDFPath + '\' +
frmData.tblParents.FieldByName­('File').asString) then
begin
frmData.qryGetChildren.Close;
frmData.qryGetChildren.SQL.Cle­ar;
frmData.qryGetChildren.SQL.Add­('Select * From Children Where
ParentId=:AParentId');
frmData.qryGetChildren.Paramet­ers.ParamByName('AParentId').D­ataType:=
ftInteger;
frmData.qryGetChildren.Paramet­ers.ParamByName('AParentId').V­alue:=
frmData.tblParents.FieldByName­('Id').asInteger;
frmData.qryGetChildren.Prepare­d:= True;
frmData.qryGetChildren.Open;
if frmData.qryGetChildren.RecordC­ount > 0 then
begin
if MessageDlg('Print Child Drawings?', mtConfirmation, [mbYes,
mbNo], 0) = mrYes then
PrintChildren:= True
else
PrintChildren:= False;
end
else
PrintChildren:= False;
frmPrinting.Show;
frmPrinting.Update;
Application.ProcessMessages;
ShellExecute( 0, 'print', PAnsiChar(PDFPath + '\' +
frmData.tblParents.FieldByName­('File').asString), nil, nil, SW_NORMAL);
if PrintChildren = True then
begin
frmData.qryGetChildren.First;
while not frmData.qryGetChildren.Eof do
begin
if FileExists(PDFPath + '\' +
frmData.qryGetChildren.FieldBy­Name('File').asString) then
begin
ShellExecute( 0, 'print', PAnsiChar(PDFPath + '\' +
frmData.qryGetChildren.FieldBy­Name('File').asString), nil, nil,
SW_NORMAL);
end //if FileExists(PDFPath + '\' +
frmData.qryGetChildren.FieldBy­Name('File').asString) then
else
ShowMessage('CHILD DRAWING : ' + #10#13 + PDFPath + '\' +
frmData.qryGetChildren.FieldBy­Name('File').asString + #10#13 + ' does
not exist!');
frmData.qryGetChildren.Next;
end; //while not frmData.qryGetChildren.Eof do
frmData.qryGetChildren.Next;
end;
frmData.qryGetChildren.Close;
end
else
ShowMessage('PARENT DRAWING : ' + #10#13 + PDFPath + '\' +
frmData.tblParents.FieldByName­('File').asString + #10#13 + ' does not
exist!');
frmPrinting.Hide;
frmPrinting.Close;
Application.ProcessMessages;
end;


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top