How to save Navision Reports as PDF
Comments
-
Something Else I would try also is open PdfCreator Printer. Click on File->Option and resetall buttonIf things go horribly awry, and you lose the ability to choose options when printing to PDFCreator, just go to the above, click on Printer\Settings, and click the big "Reset all Settings" button (shown below). That will restore you to the defaults, and you'll be good to start playing around again
http://www.excelguru.ca/node/330 -
yes this is very strange indeed. I've tried to reset all settings, and no luck, then i even installed the latest version of pdfcreator and nothing... I really don't know what's the problem, but the thing is that the other options like autosave doesn't work right either.
Regards0 -
Did you change the automation variable to latest version in your code?
you can also try Bullzip.
http://mibuso.com/blogs/ara3n/2008/08/0 -
yes i did... i'll try bullzip.0
-
Solved... with bullzip works just fine.
Thanks0 -
that's great.0
-
The 0.9.6 version of PdfCreator seems to solve the cClose function hanging behaviour. I installed this version today and it seems to be working faster, properly closing and the eReady event fires correctly.0
-
Thanks for the update. I'm sure people will upgrade to the latest one.0
-
Just looked into the functions in the just-released NAV 2009 W1.
There is a REPORT.SAVEASPDF(ReportID...) function !!! \:D/
(also contains SAVEASEXCEL and SAVEASXML)... Haven't tried them yet thou.0 -
Yes, it's a nice feature that was added but it only works on service tier.
and on RTC client.0 -
Hi Rashed,
i am using bullzip now.
on an xp machine it is working great now.
on a vista machine the code is run but there is no file.
What can it be?
the code i use is this:
Best regards,
Rod.
[-o<
recSalesHeader.SETRANGE("Document Type", Rec."Document Type");
recSalesHeader.SETRANGE("No.", Rec."No.");
IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
ReportID := REPORT::"Order Confirmation";
FileDirectory := 'C:\';
FileName :='test.pdf';
Object.GET(Object.Type::Report,'',ReportID);
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
BullZipPDF.SetValue('Output',FileDirectory+FileName);
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);
REPORT.RUNMODAL(ReportID,FALSE,FALSE,recSalesHeader);
TimeOut := 0;
WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
SLEEP(1000);
TimeOut := TimeOut + 1;
END;0 -
Hi all,
and thanks to all for this post! You all helped me a lot in my work (ara3n you're the best =D> )
After a lot of try, i successfully used pdfCreator 0.9.6 on Vista :x
the worst problem? you can't save your pdf in "c:\" !!!
if you try, pdf creator seems to work in background but the file is simply not created, without warnings or message.
I've just tried to change the directory in "d:\" and it works perfectly...
I hope i can help someone to save a lot of time testing!Lend me your strength and i'll give you mine0 -
When i start the PDF Creation the the CPU is 98 % and not stop the Report, navision hang up, when i stop the prozess the got follow Messagecoud not invoike the member cClose. The OLE control or Automation server returned an unknown error code
Here is my CodeIF ISCLEAR(PDFCreator) THEN CREATE(PDFCreator); IF ISCLEAR(PDFCreatorError) THEN CREATE(PDFCreatorError); FileDirectory := 'C:\'; FileName := 'example.pdf'; PDFCreatorError := PDFCreator.cError; IF PDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN ERROR('Status: Error[' + FORMAT(PDFCreatorError.Number) + ']: ' + PDFCreatorError.Description); PDFCreatorOption := PDFCreator.cOptions; PDFCreatorOption.UseAutosave := 1; PDFCreatorOption.UseAutosaveDirectory := 1; PDFCreatorOption.AutosaveDirectory := FileDirectory; PDFCreatorOption.AutosaveFormat := 0; //PDF file, you can also save in other formats PDFCreatorOption.AutosaveFilename := FileName; PDFCreator.cOptions := PDFCreatorOption; PDFCreator.cClearCache(); DefaultPrinter := PDFCreator.cDefaultPrinter; PDFCreator.cDefaultPrinter := 'PDFCreator'; PDFCreator.cPrinterStop := FALSE; Inv.SETRANGE("No.",'08-400002'); REPORT.RUNMODAL(REPORT::"Sales - Invoice",FALSE,TRUE,Inv); WHILE NOT EXISTS(FileDirectory + FileName) DO; PDFCreator.cPrinterStop := TRUE; PDFCreator.cDefaultPrinter := DefaultPrinter; //PDFCreator.cCloseRunningSession; PDFCreator.cClose(); CLEAR(PDFCreator); CLEAR(PDFCreatorOption); CLEAR(PDFCreatorError);
0 -
Hi,
I am using Rashed's code to print e.g. Invoices, and modify the code further to send these invoices as email to customers.
The problem I have is at saving the files to PDF. Apparently, the results of the pdf save is not consistent. Sometimes, all the invoices are saved as PDF, sometimes not all the invoices are saved as PDF. I found out that when the batch job is run, and if NAV loses focus (e.g. If you miminise nav, and do other things while the batch job is running) then not all the pdf files will be saved.
Initially, in my development, I added progress bars to update the status of the pdf save operation, but I found out that if dialog boxes are implemented, somehow, PDFcreator also loses focus, and it sometimes run into errors.
Is anybody having similar problems as what I am facing? I am beginning to think that using PDFcreator is not such a good solution after all, and looking into other alternatives.0 -
0
-
I have also experienced misc problems using PDFCreator. I used it in an WebPortal for printing Invoices and Cr.Memos, then hyperlink the saved PDF document.
(Sometimes or often there were no pdf created at all...)
I thought maybe the problem was print queues, so I also implemented Rashed Bullzip solution so that the NAS is alternating using the 2 diff
printers. The solutions is now somewhat more stable.
I would recomend you to use the Bullzip solution, thanks to Rashed for this one =D>
Best regards
ObiWan0 -
Hi,
I have found the reason for the erratic behaviour with PDFcreator. In PDFCreator if we use the following statement:
REPEAT
SLEEP(1000);
WaitTime += 1000;
IF WaitTime = 15000 THEN
ERROR('Timeout error while waiting for PDFCreator.cIsConverted!');
UNTIL PDFCreator.cIsConverted;
to check for completion of PDFcreation, you have to initialise PDFCreator.cIsConverted := FALSE. Else, somehow, the property PDFCreator.cIsConverted will always retain the values from the last run. Even if you have executed CLEAR(PDFcreator). I have run several tests with 100++ pdf creations, and the results seem to be consistent now.0 -
That is good to info to share.0
-
What if you cant set the default print to bull zip (Terminal servers)?0
-
then insert a record into printer selection for your report to print the the printer you want it to.0
-
What would be optimal is to setup the code to use the particular printer for the PDF purpose is that possible?0
-
mgm wrote:Thanx Rashed,
What a SERVICE!
This is what I added to make Bullzip default printer.IF NOT lPrinterSelection.GET('',lReportID) THEN BEGIN lPrinterSelection.INIT; lPrinterSelection."Report ID" := lReportID; lPrinterSelection."Printer Name" := 'Bullzip PDF Printer'; lPrinterSelection.INSERT; END;
Works great!
Thanx again.
Maarten
Here is the code.0 -
How can I Close the PDFCreator Process because I used PDFCreato.cClose() and only close the PDF Monitor and when it happens and if I run again the code can't creat the file. Here's my code: thanks
Window.OPEN('En proceso ...');
WindowIsOpen := TRUE;
IF _ArchivoPDF = '' THEN
ERROR('De un nombre al archivo');
IF Objeto.GET(Objeto.Tipo::Report,'',_ReportID) THEN
BEGIN
CLEAR(PDFCreator);
CREATE(PDFCreator);
PDFCreator.cStart();
//***
CLEAR(PDFCreatorOptions);
CREATE(PDFCreatorOptions);
//***
CLEAR(PDFCreatorError);
CREATE(PDFCreatorError);
IF EXISTS(_Directorio + _ArchivoPDF + '.pdf') THEN
BEGIN
ERASE(_Directorio + _ArchivoPDF + '.pdf');
END;
PDFCreatorOptions := PDFCreator.cOptions;
ReadyState := 0;
//Defaultprinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := 'PDFCreator';
PDFCreatorOptions.UseAutosave := 1;
PDFCreatorOptions.UseAutosaveDirectory := 1;
PDFCreatorOptions.AutosaveFormat := 0; //Formato PDF
PDFCreatorOptions.AutosaveDirectory := _Directorio;
PDFCreatorOptions.AutosaveFilename := _ArchivoPDF;
//PDFCreator.cOptions:=PDFCreatorOptions;
PDFCreator.cSaveOptions(PDFCreatorOptions);
PDFCreator.cClearCache();
PDFCreator.cPrinterStop := FALSE;
Filename := _Directorio + _ArchivoPDF + '.pdf';
PDFCreatorError := PDFCreator.cError;
IF ObjetoTabla.GET(ObjetoTabla.Tipo::Table,'',_TablaID) THEN
BEGIN
IF FORMAT(ObjetoTabla.Nombre)='Cab. compra' THEN
BEGIN
Cabcompra.RESET;
Cabcompra.SETFILTER(Cabcompra."Nº",No);
Cabcompra.SETFILTER(Cabcompra."Tipo documento",'Pedido');
IF Cabcompra.FIND('-') THEN
REPORT.RUNMODAL(_ReportID,FALSE,TRUE,Cabcompra);
END;
END;
PDFCreator.cClearCache();
PDFCreatorOptions.SaveFilename(Filename);
//PDFCreator.cOptions :=PDFCreatorOptions;
PDFCreator.cClose();
SLEEP(200);
//CLEAR(PDFCreatorOptions);
CLEAR(PDFCreator);
Window.CLOSE;
END;0 -
you need to wait fore the pdf file to be created, then close it. there are multiple examples for this. on this thread.0
-
Hi,
I have downloaded PDFCreator v 0.9.7 and copied Object Form 50100 Example Report to PDF Files.
But encountered an error while compiling "Could not load the selected type Library."
I am testing the PDF capabilities at the moment.
Could you help?0 -
Hi,
I have solved the problem by replacing automation at the C/AL Global
Thanks0 -
Yes, the automation variable in the form is from older version of PDF Creator. You need to reselect the global variable.0
-
Have you always yet the Problem with hanging in the 0.9.7, if it start cClose() in vista?0
-
I've a ask:
If i want to create a pdf and after i want to print the same, do you know as to do it.
I'm trying to do this, but it create a pdf but doesn't print.
IF ISCLEAR(PDFCreator) THEN
CREATE(PDFCreator);
IF ISCLEAR(PDFCreatorError) THEN
CREATE(PDFCreatorError);
PDFCreatorError := PDFCreator.cError;
IF PDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error: ' + PDFCreatorError.Description);
PDFCreatorOption := PDFCreator.cOptions;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveDirectory := Route;
PDFCreatorOption.AutosaveFormat := 0; PDFCreatorOption.AutosaveFilename := FileName;
PDFCreator.cOptions := PDFCreatorOption;
PDFCreator.cClearCache();
DefaultPrinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := 'PDFCreator';
PDFCreator.cPrinterStop := FALSE;
//Here i create a pdf
REPORT.RUN(ReportSelection."Report ID",FALSE,FALSE,SalesInvHeader);
//And here i want to print
CLEAR(PDFCreator);
CLEAR(PDFCreatorError);
REPORT.RUN(ReportSelection."Report ID",FALSE,FALSE,SalesInvHeader);
Do you know what is the problem??
Thanks0 -
Have u tried REPORT.RUN(ReportSelection."Report ID",FALSE,True,SalesInvHeader);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