How to save Navision Reports as PDF
Comments
-
The code of Rashed is the text export of the object.
Create a txt file. Copy the code of Rashed in it and save it.
Import this in NAV and compile it.
(compare the code with an object you export as a txt file)0 -
ara3n wrote:Btw bullzip doesn't have a way to change the the pdf printer to default printer, so you have to set it up in printer selection in NAV. Or make the pdf Printer as default.
Hi, i use the PDFCreator without the default printer setting.
I just use an SingleInstance CDU one command line to it
SI.SetUsePDFCreator.
In CDU 1, function FindPrinter i just call the SI cdu like this
IF SI.GetUsePDFCreator THEN
EXIT('PDFCreator');
Function in SI is like this
SetUsePDFCreator()
UsePDFCreator := TRUE;
GetUsePDFCreator() : Boolean
TMPUsePDFCreator := UsePDFCreator;
UsePDFCreator := FALSE;
EXIT(TMPUsePDFCreator);
Best regards ObiWan0 -
Hi,
Does anyone know how to do this with the acrobat distiller?
I need to be able to do it with this one. The company i work for does not want to start using another PDF writer, and believe me, they are going to hold on to that
Any help would really be appreciated...0 -
I've done it for a client a year ago.
You have to set the destiller to automatically save the documents into a folder.
Then in Nav you would wait till the pdf is finished creating.
To find out when the pdf was done, I would try and change the datetime on the file. Once that I could change it I would then attach it to the email and email it out and delete it.
It works but if something wasn't setup correctly, I wouldn't work.0 -
We leveraged your Bullzip code into the Lanham Sales E-Mail codeunit so that the report is attached to an e-mail.
We were able to create the PDF attachment if our default printer was set to "Bullzip PDF Printer." However, if we change our default printer back to our normal printer and add a record in Table 78, we no longer get the PDF attachment on the e-mail.
Any ideas why this doesn't work?SaveReportAsHTML(ReportNo : Integer;SaveFileName : Text[250]) SalesHeader.SETRECFILTER; IF ISCLEAR(BullZipPDF) THEN CREATE(BullZipPDF); ReportID := ReportNo; // REPORT::"Customer Listing"; FileDirectory := 'C:\SE_Demo\Temp'; Object.GET(Object.Type::Report,'',ReportID); FileName := SaveFileName; BullZipPDF.Init; BullZipPDF.LoadSettings; RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE); BullZipPDF.SetValue('Output',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(ReportNo,FALSE,FALSE,SalesHeader); TimeOut := 0; WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN SLEEP(1000); TimeOut := TimeOut + 1; END;
0 -
Turn on the debugger and see what FindPrinter function returns from CU 10
-
I did. It finds the record and sets PrinterName to Bullzip PDF Printer.
I should mention that I manually typed in "Bullzip PDF Printer" in the Printer Name field in Table 78. The lookup does not work.0 -
The lookup works, but you have to run the form instead of the table.
So run the form and select the printer.0 -
I added a SLEEP statement before the AddAttachment function is run and it works. Thanks for your help.0
-
Sure and your are welcome and good luck.0
-
I have just finished PDFCreator on VISTA.
During initial testing PDFCreator is working fine under VISTA Business.
I am using the PDFCreator Version 0.9.5
Many Thanks to Rashed for the code.
During my search for PDFCreator i found various ways while checking for that PDFCreator has finished printing the report or not so that it can be send by email.
I found a simple solution for the same.
Try ThisReport.RUNMODAL(***,***,***); REPEAT UNTIL PDFCreator.cIsConverted;
Harjot0 -
The solution to print to pdf is just what i'm looking for.
I have installed PDFcreator and implemented the form in a standard 5.0 SP1 database.
When pushing the button 'Print and save as PDF' the following happens:
- The report is save as PDF
- The dialog "Processing" stays open and waits
- When looking in the Task Manager of windows pdfcreator stays in the
task list.
It looks if Navision is waiting for the task pdfcreator to close. Therefor the trigger PDFCreator::eReady() is not activated.
Does anyone know what the problem is.
Thanks in advance.0 -
you change the code and instead use thee following code mentioned by hs_mann
REPEAT
UNTIL PDFCreator.cIsConverted;0 -
hELlo dearest colleagues,
there is no other way to begin this posting but thanking to Rashed [;)] it's an indeed great example.
But i still get that 'processing' mistake everytime with pdf creator consuming 98% of my cpu and navision blocking unless i terminate pdf creator on task manager.
then i get the also-mentioned 'can't call pdf.cclose' mistake.you change the code and instead use thee following code mentioned by hs_mann
REPEAT
UNTIL PDFCreator.cIsConverted;
i tried this but it did not work...must i kill the automation? try to call the eReady event somehow? shoudn't it be automatically triggered?
thanks for the help already given and
thanks in advance as well
miguel0 -
Hello you can use also bullzip.
Here is my blog on this.
http://mibuso.com/blogs/ara3n/2008/08/0 ... ts-to-pdf/0 -
Hi ara3n,
The sample reports you created are a great service to everyone. Thanks.
Now, I have a slight situation with PDFCreator that's really bugging me. I am running on Windows Vista, but surprisingly your code is running fine...except for one little glitch: I can't choose the destination filename. I set the AutoSave feature in the code, and I specify the filename and directory, but for whatever reason, I cannot save the PDF file to my desired location and name. In fact, I even have AutoSave checked in PDFCreator options, otherwise the save dialog keeps popping up, regardless of my code. Below is a snippet of my code...// GRAME01 - Add Start IF 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); Window.OPEN('processing'); WindowisOpen := TRUE; IF FileName = '' THEN ERROR('Please specify what the file should be saved as'); 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; TempSalesInvoiceHeader.COPYFILTERS(Rec); Rec.SETRANGE("No.", Rec."No."); REPORT.RUNMODAL(10074,FALSE,TRUE, Rec); Rec.COPYFILTERS(TempSalesInvoiceHeader);
As you can see, my code is almost exactly the same as yours, but I simply can't get it to autosave and use my filename and directory.
Please help!
Thanks in advance for your support.0 -
hI THERE again!
just wanted to say i'm using bullzip now and it works just fine!
thx a lot! it's perfect!
best regards,
miguel andrade0 -
Boom-Box wrote:hI THERE again!
just wanted to say i'm using bullzip now and it works just fine!
thx a lot! it's perfect!
best regards,
miguel andrade
I'm glad that it works. Enjoy.0 -
David Singleton wrote:?? ?Vista??? Whats that? =;Regards,
Arturs Gedvillo
CTO0 -
So why did Vista cross the road?0
-
Thanks to Rash,
Don't use PDF Creator in NAV 5.0 SP1 environment.
BullZip is the good solution. It works perfectly.
Patrice0 -
-
With Pdf creator in a NAV 5.0 SP1 context, you have to stop the process manually!!!
You don't have this problem with Bullzip.
Thank's again to Rashed.
Patrice0 -
pbally wrote:With Pdf creator in a NAV 5.0 SP1 context, you have to stop the process manually
Can you explain what you mean by this?David Singleton0 -
Hi,
i want to set a password on a pdf file and i have this code :
IF ISCLEAR(PDFCreator) THEN
CREATE(PDFCreator);
IF ISCLEAR(PDFCreatorError) THEN
CREATE(PDFCreatorError);
PDFCreatorError := PDFCreator.cError;
IF PDFCreator.cStart('/NoProcessingAtStartup') = FALSE THEN
ERROR('Status: Error: ' + PDFCreatorError.Description);
PDFCreatorOption := PDFCreator.cOptions;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveFilename := 'Recibo de Vencimento.pdf';
PDFCreatorOption.AutosaveFormat := 0;
PDFCreatorOption.AutosaveDirectory := 'C:\Temp';
PDFCreatorOption.PDFUseSecurity:=1;
PDFCreatorOption.PDFDisallowCopy:=1;
PDFCreatorOption.PDFDisallowModifyContents:=1;
PDFCreatorOption.PDFDisallowPrinting:=1;
PDFCreatorOption.PDFOwnerPass:=1;
PDFCreatorOption.PDFOwnerPasswordString:='teste';
PDFCreatorOption.PDFUserPass:=1;
PDFCreatorOption.PDFUserPasswordString:='teste';
PDFCreatorOption.PDFHighEncryption:=1;
PDFCreator.cOptions := PDFCreatorOption;
PDFCreator.cClearCache();
DefaultPrinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := 'PDFCreator';
PDFCreator.cPrinterStop := FALSE;
REPORT.RUNMODAL(50101,FALSE,FALSE,EmpPDF);
PDFCreator.cClose;
CLEAR(PDFCreatorOption);
CLEAR(PDFCreator);
CLEAR(PDFCreatorError);
but it doesn't work. It creates the file but no password.
Any clues?
Best regards0 -
Try this
//TEST PASSWORD PDFCreatorOption.PDFUseSecurity :=1; PDFCreatorOption.PDFOwnerPass := 1; PDFCreatorOption.PDFOwnerPasswordString := 'MasterPass'; PDFCreatorOption.PDFDisallowCopy := 1; PDFCreatorOption.PDFDisallowModifyContents := 1; PDFCreatorOption.PDFDisallowPrinting := 1; PDFCreatorOption.PDFUserPass := 1; PDFCreatorOption.PDFUserPasswordString := 'UserPass'; PDFCreatorOption.PDFHighEncryption := 1; //TEST PASSWORD
0 -
thanks, but no success...0
-
It has worked for others.
viewtopic.php?f=5&t=18331&st=0&sk=t&sd=a&start=45
So I don't know why it would not work for you. I would try and reboot.
Make sure the code is exactly as the example above.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