PDF Creator

Navision Articles

Get our Free Newletter

Don't you have the time to be online here at DUG every day? So how do you follow what is going on in the Dynamics industry and community?
If you subscribe to the DUG Newsletter then you can relax! We will make sure that you don't miss the big news!

Check out our
Newsletter Subscription Center
page a complete list of our different newsletters.

This post has 7 Replies | 1 Follower

Not Ranked
Male
Posts 10
100 Points
Joined: Apr 25, 2008
Last Online:
May 18, 2009 12:25
Zas_getrunken Posted: Nov 7, 2008 10:25
How helpful was this post/question? Please rate here:

I need to generate a PDF from report and i don`t know why the first time i execute the code is OK but when i change the name of the file and execute again the code it saves the report with the first name. Somebody knows what is wrong?

The code:

 
Window.OPEN('En proceso ...');
WindowIsOpen := TRUE;
IF _ArchivoPDF = '' THEN
  ERROR(Text001);

IF Objeto.GET(Objeto.Type::Report,'',204) THEN BEGIN

  IF ISCLEAR(PDFCreator) THEN BEGIN
    CREATE(PDFCreator);
    PDFCreator.cStart();
  END;
  IF ISCLEAR(PDFCreatorError) THEN
    CREATE(PDFCreatorError);
  PDFCreatorError := PDFCreator.cError;

  PDFCreatorOptions := PDFCreator.cOptions;

  PDFCreatorOptions.UseAutosave := 1;
  PDFCreatorOptions.UseAutosaveDirectory := 1;
  PDFCreatorOptions.AutosaveDirectory := _Directorio;
  PDFCreatorOptions.AutosaveFormat := 0;   //Formato PDF
  PDFCreatorOptions.AutosaveFilename := _ArchivoPDF;

  PDFCreator.cOptions := PDFCreatorOptions;
  PDFCreator.cClearCache();
  PDFCreator.cDefaultPrinter := TextPdfCreator;
  PDFCreator.cPrinterStop := FALSE;
  REPORT.RUNMODAL(_ReportID,FALSE,TRUE,_SalesHeader);
  PDFCreatorOptions.SaveFilename('File 1');
  PDFCreator.cClose();
  CLEAR(PDFCreator);
  Window.CLOSE;
END;

Top 25 Contributor
Male
Posts 690
8,700 Points
Joined: Nov 17, 2003
Last Online:
Mar 15, 2010 13:04
Location: Sunny Scotland
jsrark replied on Nov 7, 2008 11:27
How helpful was this comment/solution? Please rate here:

Where and how do you set 'File 1' ?

 

Jonathan.

Don't forget to the post(s) that solved your problem. This credits the experts who helped, earns you points and marks your thread as Resolved so we all know you have been helped.

Top 50 Contributor
Male
Posts 586
9,220 Points
Joined: Aug 5, 2003
Last Online:
Mar 18, 2010 16:18
Location: Washington DC
DynamicsNAVMVP
Rashed Amini replied on Nov 7, 2008 14:05
How helpful was this comment/solution? Please rate here:
you need to move out PDFCreator.cStart(); out of if statement?
Not Ranked
Male
Posts 10
100 Points
Joined: Apr 25, 2008
Last Online:
May 18, 2009 12:25
Zas_getrunken replied on Nov 7, 2008 14:07
How helpful was this comment/solution? Please rate here:

I resolved it. I forgot to save options and when i execute the code the options are always the estandar. The code is like this:

 Window.OPEN('En proceso ...');
WindowIsOpen := TRUE;
IF _ArchivoPDF = '' THEN
  ERROR(Text001);

IF Objeto.GET(Objeto.Type::Report,'',204) THEN BEGIN

  IF ISCLEAR(PDFCreator) THEN BEGIN
    CREATE(PDFCreator);
    PDFCreator.cStart();
  END;
  IF ISCLEAR(PDFCreatorError) THEN
    CREATE(PDFCreatorError);
  PDFCreatorError := PDFCreator.cError;

  PDFCreatorOptions := PDFCreator.cOptions;

  PDFCreatorOptions.UseAutosave := 1;
  PDFCreatorOptions.UseAutosaveDirectory := 1;
  PDFCreatorOptions.AutosaveDirectory := _Directorio;
  PDFCreatorOptions.AutosaveFormat := 0;   //Formato PDF
  PDFCreatorOptions.AutosaveFilename := _ArchivoPDF;

  PDFCreator.cOptions := PDFCreatorOptions;

  //TO SAVE OPTIONS

PDFCreator.cSaveOptions(PDFCreatorOptions);

 

  PDFCreator.cClearCache();
  PDFCreator.cDefaultPrinter := TextPdfCreator;
  PDFCreator.cPrinterStop := FALSE;
  REPORT.RUNMODAL(_ReportID,FALSE,TRUE,_SalesHeader);
  PDFCreatorOptions.SaveFilename('File 1');
  PDFCreator.cClose();
  CLEAR(PDFCreator);
  Window.CLOSE;
END;

 

ThanksBig Smile

Not Ranked
Posts 1
15 Points
Joined: Mar 13, 2007
Last Online:
Jan 11, 2010 15:05
muca replied on Feb 20, 2009 9:04
How helpful was this comment/solution? Please rate here:

what type and subtype you use for variables PDFCreator, PDFCreatorError and PDFCreatorOptions?

Top 500 Contributor
Male
Posts 41
445 Points
Joined: Dec 3, 2008
Last Online:
May 28, 2009 13:52
Location: trivandram
yogesh kumar replied on Feb 20, 2009 9:43
How helpful was this comment/solution? Please rate here:

hi

Name                                   DataType                                                Subtype 

PDFCreator                     Automation                                'PDFCreator'.clsPDFCreator 
PDFCreatorOption         Automation                              'PDFCreator'.clsPDFCreatorOptions 
PDFCreatorError            Automation                               'PDFCreator'.clsPDFCreatorError 

Not Ranked
Male
Posts 10
100 Points
Joined: Apr 25, 2008
Last Online:
May 18, 2009 12:25
Zas_getrunken replied on Feb 20, 2009 9:43
How helpful was this comment/solution? Please rate here:

they are automations

PDFCreator is 'PDFCreator'.clsPDFCreator

PDFCreatorError is 'PDFCreator'.clsPDFCreatorOptions

PDFCreatorOptions is 'PDFCreator'.clsPDFCreatorError

Not Ranked
Posts 2
15 Points
Joined: Jan 28, 2009
Last Online:
Jan 4, 2010 9:12
nawaless replied on Feb 23, 2009 12:23
How helpful was this comment/solution? Please rate here:

hi

Dear Yogesh Kumar can you tell me wich type of dll (Automation ) I should use to declaire following variables

PDFCreator                     Automation                                'PDFCreator'.clsPDFCreator 
PDFCreatorOption         Automation                              'PDFCreator'.clsPDFCreatorOptions 
PDFCreatorError            Automation                               'PDFCreator'.clsPDFCreatorError 

Page 1 of 1 (8 items) | Get this RSS feed | Bookmark and Share