Printing to PDF... yet again

Ok… This is what I want to be able to do if it is possible. I have the full version Acrobat Reader (i.e. Acrobat Writer… the one you pay for so I can create pdf files). Now, on the request form I want to have an option to e-mail the report. However, I cannot figure out how to automatically print the pdf file (i.e. without the user having to specify the printer and filename when they hit print). Do I have to temporarily add an entry in the Printer Selection table to specify the Printer (then delete it afterwards, because I still want them to be able to print to their regular printer(s)), or is there some property that I can set on the Report (at run-time) that will do this? Is there a way to supress the Print Dialog box (while still showing the request form, because I still need them to be able to use the request form)? And finally, specifying the SaveAs filename. Does Navision have some kind of SendKeys function or anything else that would do the trick? Is there any way to edit the registry from within Navision? Any help/direction is appreciated. Thanks, Mark.

Unfortunately there is no way (that I know of) to control the Adobe pdf-printer in the way You wan’t. Instead You can use Amyunis pdf-converter. With that You can the things You described. //Lars

Dear Mark, You have requested for the decision of an interesting task. So, it was done in a simple way. Follow my idea: 1. You have the printer “Acrobat Distiller” installed in your system. I’m sure that it’s true because you have told it in your previous message. This printer can be default as well as not. 2. Go to the printer properties and set up the parameters as shown below:


Ports: 
Port = ‘C:\TEMP’
Description = ‘PDF Port’
Printer = ‘Acrobat Distiller’

General -> Printing Preferences -> Adobe PDF Settings:
View Results in Acrobat = Off,
Prompt for PDF Filename = Off
Delete log files for successful jobs = On
Ask to Replace existing PDF file = Off
  1. Set up the entry in the Printer Selection table ( NA: GL → Setup → Printer Selections The entry like:
User ID = ‘’
Report ID = ‘70102’
Printer Name = ‘Acrobat Distiller,Ne02:’
Report Name = ‘TEST Chart of Accounts’
  1. Go to the Object Designer for some modifications making I have copied the ‘Chart of Accounts’ into my example for modifications and testing. 5. Add a button like ‘E-mail PDF’ at the Request form and switch into C/AL Code window. 6. Write some code like:
 
OnPush=
VAR
Mail@1000000002 : Codeunit 397;
  cCaption@1000000001 : Text[250];
BEGIN
  REPORT.RUNMODAL(ATOI(
  DELSTR(CurrReport.OBJECTID(FALSE), 1, STRLEN('Report '))),
  FALSE, FALSE);

  cCaption := DELSTR(CurrReport.OBJECTID(TRUE), 1, STRLEN('Report '));

  Mail.NewMessage('ypokusaev@yahoo.com','',
  'Navision Report: '+cCaption,
  'Please find attached PDF-file: '+cCaption,
  'C:\TEMP\'+cCaption+'.pdf',
  FALSE);
END;

PROCEDURE ATOI@1000000000(cNumber@1000000000 : Text[255]) nNumber@1000000003 : Integer;
VAR
  nIndex@1000000001 : Integer;
  nLen@1000000002 : Integer;
BEGIN
  nNumber := 0;
  nLen := STRLEN(cNumber);
  FOR nIndex := 0 TO STRLEN(cNumber)-1 DO
    nNumber := nNumber + (STRPOS('0123456789',COPYSTR(cNumber,nLen-nIndex,1))-1) * POWER(10, nIndex);
END;

Done. Thanks for the interesting conundrum. If you have any questions, don’t hesitate to contact me. Regards, Yuri Pokusaev IBS, Senior Consultant NCPS, NCSD ypokusaev@yahoo.com +7(095)987-8080 Edited by - ypokusaev on 2001 Nov 17 22:55:17

if you have the latest version of the acrobat pdf writer, after you have installed it, you should see 2 acrobat printer drivers. one will enable you to create and save a pfd file, while the other will create and open the pdf writer program for you (it will not save the file for you). from here, it is like the print preview for the acrobat writer. you can choose to save the pdf file, print the pdf file or send it as an e-mail attachment. jordan