How to save Navision Reports as PDF

2456710

Comments

  • gisongison Posts: 128Member
    Dear all,

    Does anyone can tell me how to import and compile the ara3n's code?
    Create it a codeUnit or? :-s
    thanks
  • ara3nara3n Posts: 9,147Member
    create a text file. Copy and paste the code into it. and then import the txt file into navision.
  • gisongison Posts: 128Member
    then it would become a Form 50100 ? :o
    thank you
  • gisongison Posts: 128Member
    Hello ara3n,
    When I compiled it, it showed me a error as [You connot enter 'Item List' in ReportNo.]
    Then the cursor jump to OnOpenForm() trigger where have a statement is
    ReportID := REPORT::"Item List";

    Did I have do anything wrong? :?: or do you have a report call "Item List"? then I need to change to any of mine?
    thank you.

    Then I cannot find the Form property soureTable is empty... is it right?
    thank you.
  • ara3nara3n Posts: 9,147Member
    Yes there is no source table for the report, and yes you can change the report to anyy of your report.
  • ara3nara3n Posts: 9,147Member
    gison wrote:
    then it would become a Form 50100 ? :o
    thank you

    You can change that to a different ID based on your license.
  • gisongison Posts: 128Member
    ara3n wrote:
    gison wrote:
    then it would become a Form 50100 ? :o
    thank you

    You can change that to a different ID based on your license.

    This PDFcreator demonstration is amazing.....
    I'm appreciated your kindness.
    :)
  • ara3nara3n Posts: 9,147Member
    gison wrote:
    ara3n wrote:
    gison wrote:
    then it would become a Form 50100 ? :o
    thank you

    You can change that to a different ID based on your license.

    This PDFcreator demonstration is amazing.....
    I'm appreciated your kindness.
    :)

    You are welcome. :)
  • gisongison Posts: 128Member
    Hi ara3n,

    sorry...could i ask you ...what are the PDFCreator:eReady() and PDFCreator::eError? They look like function, but I cannot find it in C/AL Globals functions Form.... :?
  • ara3nara3n Posts: 9,147Member
    Those are events.

    in the global variable, when you declare the variable to the automation, you can click on property and you'll see a property called WithEvents if you set it to yes, it will show the event triggers in navision where you can put code to do certain things in an event.
  • gisongison Posts: 128Member
    Thanks for your patience.
    You really help me a lot.
    :o
  • gisongison Posts: 128Member
    Hi ara3n,

    I tried to change the statement "REPORT.RUNMODAL(ReportID,TRUE,TRUE)"
    which mean we can launch report with request window, but the pdf couldn't be generated. Is't always have this limitation or did I lose something?

    thank you.
  • ara3nara3n Posts: 9,147Member
    If you want to generate a pdf. you can run the report and select the pdf creator printer. No need for any code.

    This code automates the process. So that you can create many pdf documents.
  • gisongison Posts: 128Member
    :| appreciate your help.
  • matias_jaurematias_jaure Posts: 157Member
    Thank you very much man! you save me, I was looking for this, I had to create a pdf with several invoices and I didn't know how. I can do it with your code.. Thanks again!
  • ara3nara3n Posts: 9,147Member
    You are welcome. :)
  • dfragosodfragoso Posts: 18Member
    Hi,

    How can i use the password mode of PDFCreator in Navision? I add this lines but the pdf file is not created...
    ...
    
    PDFCreatorOption.UseAutosave := 1; 
    PDFCreatorOption.UseAutosaveDirectory := 1; 
    PDFCreatorOption.AutosaveDirectory := FileDirectory; 
    PDFCreatorOption.AutosaveFormat := 0;                       //PDF file, you can also save in other formats 
    PDFCreatorOption.AutosaveFilename := FileName; 
    
    //TEST PASSWORD
    PDFCreatorOption.PDFUseSecurity :=1;
    PDFCreatorOption.PDFEncryptor := 1;
    PDFCreatorOption.PDFLowEncryption := 1;
    PDFCreatorOption.PDFUserPass := 1;
    PDFCreatorOption.PDFUserPasswordString := 'test';
    //TEST PASSWORD
    
    PDFCreator.cOptions := PDFCreatorOption; 
    PDFCreator.cClearCache(); 
    DefaultPrinter := PDFCreator.cDefaultPrinter; 
    PDFCreator.cDefaultPrinter := 'PDFCreator'; 
    PDFCreator.cPrinterStop := FALSE; 
    
    REPORT.RUNMODAL(ReportID,FALSE,TRUE); 
    
  • ara3nara3n Posts: 9,147Member
    Change the code to something like 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 
    
  • dfragosodfragoso Posts: 18Member
    Tks for the help, the code works perfect.
  • ara3nara3n Posts: 9,147Member
    dfragoso wrote:
    Tks for the help, the code works perfect.

    You are welcome.
  • NizarzNizarz Posts: 12Member
    Hi,
    i'm trying to run this example, but when i imported the object and tried to compil it, i got this error : " you can't write "Item list" in ReportNo. and the cursor was leaded to the code which is in the "OnOpenForm" Part ...
    can u help please ? ](*,)
  • SavatageSavatage Posts: 7,134Member
    you don't have an "Item List" Report? PIck a different report to test.
  • ara3nara3n Posts: 9,147Member
    Nizarz wrote:
    Hi,
    i'm trying to run this example, but when i imported the object and tried to compil it, i got this error : " you can't write "Item list" in ReportNo. and the cursor was leaded to the code which is in the "OnOpenForm" Part ...
    can u help please ? ](*,)

    change this line

    ReportID := REPORT::"Item List";
    to
    ReportID := REPORT::"Customer - Labels";

    or to another report you want to print.
  • David_SingletonDavid_Singleton Posts: 5,367Member
    I would like to vote this as

    "Most useful thread ever on MiBuSo"


    Thanks Rashed, I know its simple and I know anyone could do it, but YOU DID IT, thanks for sharing this, I am sure that collectively you have saved the community hundreds of hours messing about to solve all these silly issues.

    You should save it as a Download some how (even just as a text file of the source) so that we can vote for it. I am sure it would win the next "Best Down Load" Competition.


    It also serves as a great example of how something so simple can be so useful in NAV, a great lesson for all the newbies out there.

    =D>
    David Singleton
  • David_SingletonDavid_Singleton Posts: 5,367Member
    Oh an d the reason I was actually here....


    Has anyone else come across the error where PDF objects created in ver. 0.9.3 won't run on 0.9.5 and vica versa. Basically the comand below will only run on a coumputer running the same version of PDFCreator that it ws complied with.

    The issue is the command
    PDFCreatorOption :=  PDFCreator.cOptions;
    

    Which gives the message:
    This message is fo C/AL programmers:
    Invalid assignment. It is not possible to assign a _clsPDFCreatorOptions to a clsPDFCreatorOptions.

    Its clearly an issue with wich dll you have registered, and I am pretty sure its a PDF creator issue, not a NAV issue.

    Its damn anoying having to use a different computer to compile objects to get this to work, and worst is when a client has computers with differnt version of PDF creator installed.

    Has anyone solved this?
    David Singleton
  • WaldoWaldo Posts: 3,412Member
    Anyone knows if PDFCreator works on Vista already?
    Can't find it in the forums ...

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • David_SingletonDavid_Singleton Posts: 5,367Member
    Waldo wrote:
    Anyone knows if PDFCreator works on Vista already?
    Can't find it in the forums ...


    ?? ?Vista??? Whats that? =;
    David Singleton
  • WaldoWaldo Posts: 3,412Member
    Actually, I don't know. But i googled it, and found this. :mrgreen:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • NizarzNizarz Posts: 12Member
    Hi all,
    i'm using already cute pdf for editing my reports in PDF format, but i want to send them in this format via Navision ... anyone can help please ](*,) ... Thnaks
  • ara3nara3n Posts: 9,147Member
    Nizarz wrote:
    Hi all,
    i'm using already cute pdf for editing my reports in PDF format, but i want to send them in this format via Navision ... anyone can help please ](*,) ... Thnaks

    If you are editing your documents in Cute pdf, navision can't open the pdf document.

    You need to modify or create a Navision report that you can the print to PDF.
Sign In or Register to comment.