Issue with PDF Report

Shabna_Nazar
Member Posts: 10
Hi,
I'm having an issue with PDF report in navision.I have used the code below to print and save as PDF. When trying to print a particular Purchase Order, it is printing all the POs present in the system. Also I used the same code for Sales Order, for that it is always printing the 1st Sales Order only. Please help me in this issue.
OnOpenForm() trigger
IF ISCLEAR(PDFCreatorG) THEN
CREATE(PDFCreatorG);
IF ISCLEAR(PDFCreatorErrorG) THEN
CREATE(PDFCreatorErrorG);
ReportIDG := REPORT::Order;
IF ObjectG.GET(ObjectG.Type::Report,'',ReportIDG) THEN;
FileDirectoryG := 'C:\';
FileNameG := 'Purchase Order.pdf';
PDFCreatorErrorG := PDFCreatorG.cError;
IF PDFCreatorG.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error: ' + PDFCreatorErrorG.Description);
OnPush() trigger
WindowG.OPEN('processing');
WindowisOpenG := TRUE;
IF FileNameG = '' THEN
ERROR('Please specify what the file should be saved as');
ObjectG.GET(ObjectG.Type::Report,'',ReportIDG);
PDFCreatorOptionG := PDFCreatorG.cOptions;
PDFCreatorOptionG.UseAutosave := 1;
PDFCreatorOptionG.UseAutosaveDirectory := 1;
PDFCreatorOptionG.AutosaveDirectory := FileDirectoryG;
PDFCreatorOptionG.AutosaveFormat := 0; //PDF file, you can also save in other formats
PDFCreatorOptionG.AutosaveFilename := FileNameG;
PDFCreatorG.cOptions := PDFCreatorOptionG;
PDFCreatorG.cClearCache();
DefaultPrinterG := PDFCreatorG.cDefaultPrinter;
PDFCreatorG.cDefaultPrinter := 'PDFCreator';
PDFCreatorG.cPrinterStop := FALSE;
REPORT.RUNMODAL(ReportIDG,FALSE,TRUE);
I'm having an issue with PDF report in navision.I have used the code below to print and save as PDF. When trying to print a particular Purchase Order, it is printing all the POs present in the system. Also I used the same code for Sales Order, for that it is always printing the 1st Sales Order only. Please help me in this issue.
OnOpenForm() trigger
IF ISCLEAR(PDFCreatorG) THEN
CREATE(PDFCreatorG);
IF ISCLEAR(PDFCreatorErrorG) THEN
CREATE(PDFCreatorErrorG);
ReportIDG := REPORT::Order;
IF ObjectG.GET(ObjectG.Type::Report,'',ReportIDG) THEN;
FileDirectoryG := 'C:\';
FileNameG := 'Purchase Order.pdf';
PDFCreatorErrorG := PDFCreatorG.cError;
IF PDFCreatorG.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error: ' + PDFCreatorErrorG.Description);
OnPush() trigger
WindowG.OPEN('processing');
WindowisOpenG := TRUE;
IF FileNameG = '' THEN
ERROR('Please specify what the file should be saved as');
ObjectG.GET(ObjectG.Type::Report,'',ReportIDG);
PDFCreatorOptionG := PDFCreatorG.cOptions;
PDFCreatorOptionG.UseAutosave := 1;
PDFCreatorOptionG.UseAutosaveDirectory := 1;
PDFCreatorOptionG.AutosaveDirectory := FileDirectoryG;
PDFCreatorOptionG.AutosaveFormat := 0; //PDF file, you can also save in other formats
PDFCreatorOptionG.AutosaveFilename := FileNameG;
PDFCreatorG.cOptions := PDFCreatorOptionG;
PDFCreatorG.cClearCache();
DefaultPrinterG := PDFCreatorG.cDefaultPrinter;
PDFCreatorG.cDefaultPrinter := 'PDFCreator';
PDFCreatorG.cPrinterStop := FALSE;
REPORT.RUNMODAL(ReportIDG,FALSE,TRUE);
0
Comments
-
Of course, you do not pass the Record filtered for the document you want to print in your last command REPORT.RUNMODAL. You need to add one parameter there... ;-)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions