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)
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
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...
There are no bugs, only random undocumented features...
---
My Blog: http://NAV-Magno.be
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.
Ahmed Rashed Amini
Independent Consultant/Developer
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.
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 This
Report.RUNMODAL(***,***,***);
REPEAT
UNTIL PDFCreator.cIsConverted;
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.
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
sometimes when I run the form to automatically email pdf reports, the reports are not generated. However, if at some point before that you go and manually run the report, then the form works fine. Anyone else experience this behavior?
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.
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.
Patrice
Comments
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)
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...
---
My Blog: http://NAV-Magno.be
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.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
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?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I should mention that I manually typed in "Bullzip PDF Printer" in the Printer Name field in Table 78. The lookup does not work.
So run the form and select the printer.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
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 This
Harjot
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.
REPEAT
UNTIL PDFCreator.cIsConverted;
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
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.
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
miguel
Here is my blog on this.
http://mibuso.com/blogs/ara3n/2008/08/0 ... ts-to-pdf/
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/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...
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.
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.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Arturs Gedvillo
CTO
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Don't use PDF Creator in NAV 5.0 SP1 environment.
BullZip is the good solution. It works perfectly.
Patrice
Why not?
You don't have this problem with Bullzip.
Thank's again to Rashed.
Patrice
Can you explain what you mean by this?
This has happened to me with 3.7
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 regards
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
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.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n