NAV2016 - Report is printed or saved as pdf ?

aod74aod74 Member Posts: 4
Dear all,

I have a Report, that uses a logo.. everything works fine, but now I have the request to hide the Logo when the Report is printed, but show it when the Repost is saved as pdf using the Option "Save as pdf" from the Request Page.

How can I do this ? Any Possibility to set a Variable at Request Page, depending which Option is chosen (or Button is pressed) ?

Thank you

Answers

  • rehansattirehansatti Member Posts: 36
    Hi @aod74, Include a Boolean variable in the data-set o report. Set the value of this variable to true or false on the relevant action. For example set this variable true on Print. Attach this variable to the visibility control on the report. That,s All.
    Best Regards
    Rehan Satti
    Microsoft Dynamics NAV Technical Consultant
    Please verify the answer if it satisfy your question. This will help other members of community.
  • aod74aod74 Member Posts: 4
    edited 2017-02-08
    Thank you rehansatti, but I think I did not describe the Problem really good.. What you have written is clear for me, but how can the Report know at Runtime if it's called to print or "saveaspdf" .. I can use CurrReport.Preview to know if it's a Preview.. But how to find out if Report is called by "Save PDF" Option from the request Page
  • TiwazTiwaz Member Posts: 98
    I think that this, as described, is impossible to determine at runtime.
    I suggest following solution which will, perhaps, be acceptable by your clients.
    You can add a boolean field to RequestPage, put logo inside rectangle and set rectangle visibility to be HIDDEN if that boolean field is being checked.
    For example, that boolean field could be called: Hide company logo.
  • aod74aod74 Member Posts: 4
    Thank you Tiwaz. I think this is not an acceptable solution and will not work in this case because most Invoices are booked by Batch-Post of Sales Order and there are some Customers that get printed Docs by Mail and others that should get them as pdf via E-Mail ..

    I hope somebody can help me..
  • binilabrahambinilabraham Member Posts: 45
    Just try this way, Create an Option variable with two options like ; Print,PDF. Use this option in your request page. Then set a visibility expression to hide or show the logo as per the option you selected in request page. Like this; IIF(Fields!ReqOptionValue.Value="Print",TRUE,FALSE)
    Software Developer,
    Archerpoint India Pvt. Ltd,Chennai.
  • rehansattirehansatti Member Posts: 36
    In the request Page set the page property savevalue to Yes So it will keep the option values saved.
    Best Regards
    Rehan Satti
    Microsoft Dynamics NAV Technical Consultant
    Please verify the answer if it satisfy your question. This will help other members of community.
  • kaspermoerchkaspermoerch Member Posts: 43
    edited 2017-02-14
    I think your option would be to take at look at how the Customer Statement (Report 116) is handled.

    It's marked as Processing Only and then has an output option on the request page, where you select the output you want.

    Then when the report is run it calls itself again, but this time using the Report.SAVEAS, specifying the output according to what was selected on the the request page or using Report.PRINT.

    You might however need to modify the way reports are run when doing e.g. Batch Post.
  • armelaarmela Member Posts: 20
    aod74, did you come up with a solution on this ? DO you mind sharing ? I need to do exactly the same thing.
  • xStepaxStepa Member Posts: 106
    Hi, there is a way to detect it using the DotNet and call stack (System.Diagnostics.StackTrace), but it's not very easy and clean solution ...
    Regards
    xStepa
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I also don't understand the problem. I mean if the issue is that the report needs to be printed by batch, then there's somewhere a condition that determines whether the current customer wants to have a hardcopy or an email. You can use the same condition to decide whether to show the logo or not.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • jglathejglathe Member Posts: 639
    Hi there,

    I happened to have exactly the same requirement. Solution is to have a field in the root table of the report (like Sales Invoice Header), and set a filter on it in appropriate places (codeunit 452, EmailDocument() among them, but (for NAV2016) not the only one). In the report, on OnPreDataItem, check for the filter, take action (show logo or not), and remove the filter on this field. The report has no other way to know it's printing in SAVEASPDF mode.
    Now my issue with SAVEASPDF is this: The logo image gets distorted, in fact really botched up when the report prints via SAVEASPDF. It doesn't when you use a printer driver, or to Word/Excel the logo image stays as it should. Anybody seen this? And how do you avoid it?

    with best regards

    Jens
  • jglathejglathe Member Posts: 639
    jglathe wrote: »

    And how do you avoid it?

    Well, this seems to be an issue with jpegs as an embedded image in the RDLC report. Use a png file, and it works.

    Merry christmas everybody. :)

  • vaprogvaprog Member Posts: 1,116
    For RDL rendering you can use Globals!RenderFormat.Name in a visibility condition.

    I guess there will be something similar using VBA for Word layout.
Sign In or Register to comment.