When President Trump decided to cooperate with Bob Woodward, he went all in.

He started calling the reporter at night, and Melania walked in during one conversation. After Woodward made a little small talk with the first lady, the president explained he was being interviewed for the author’s next book.

“It’ll probably be atrocious, but that’s okay,” Trump said.

Since most of his aides are admitting they either didn’t know of the project or thought it was an awful idea, it’s worth examining why Trump decided to spend nine hours talking to Woodward, with all but one conversation on tape.

WOODWARD BOOK LANDS, QUOTES TRUMP ACKNOWLEDGING ‘DEADLY’ VIRUS EARLY ON

Was it risky? Richard Nixon, the first president Woodward pursued, was ousted when he had to disclose his secret White House tapes. But Trump knew the Woodward tapes would be made public. In fact, he urged Jared Kushner and other top aides to cooperate with the “Rage” project.

On a practical level, Trump figured that last time he wound up with a negative book (“a scam,” he said) after not talking to Woodward, so maybe he could get a better outcome this time. He has immense confidence in his ability to win over even harsh critics, which I’ve seen in action.

For all his attacks on fake news, Trump on some level craves the approval of the establishment media. He recently spent 40 minutes talking to a New York Times reporter, despite years of attacks on his hometown paper as biased and “failing.” And who is more of an establishment Beltway figure than Woodward?

But as officials in the Nixon, Reagan, Bush 41, Clinton, Bush 43 and Obama administrations learned, charming Woodward is a strategy that only goes so far. It’s hard for officials to say no to him when you realize you’ll be in the book anyway and many of your colleagues, and rivals, are probably cooperating.

But Trump’s calculation wasn’t all wrong. Although his coronavirus comments sparked a media explosion, the book is filled with lengthy presidential quotes, making the case on issues from the pandemic to race relations to foreign policy.

Trump is always his own best spokesman.

SUBSCRIBE TO HOWIE'S MEDIA BUZZMETER PODCAST, A RIFF OF THE DAY'S HOTTEST STORIES

Woodward’s use of unnamed sources usually trigger controversy, but there is less of that this time, since he’s got the ultimate inside source. Verbatim criticism of Trump attributed to former Defense secretary Jim Mattis and ex-intelligence director Dan Coats have not been denied.

The president’s view of the press is reflected in one conversation about another book, “A Very Stable Genius,” by Washington Post reporters Phil Rucker and Carol Leonnig. Trump took issue with one anecdote and said “this is all made up.”

Woodward said they were excellent reporters with sources and this was “a good-faith effort.”

Trump retreated to “70 percent of it is made up.”

Woodward said that journalists sometimes got things wrong but were making good-faith efforts.

“Well,” Trump joked, “I have Russia and Sean Hannity with me.”

Perhaps the most striking part of the book, given the Sgt. Friday approach that Woodward has pursued throughout his career, is the opinionated epilogue.

He said he was weary, had talked things over with his wife, journalist Elsa Walsh, and concluded Trump was the problem:

“The oversized personality. The lack of discipline. The lack of trust in others he had picked, in experts. The undermining or attempted undermining of so many institutions...The unwillingness to acknowledge error.” The final sentence: “Trump is the wrong man for the job.”

With those words, he has opened himself up to criticism that, two months before the election, his purpose is to help defeat Trump. The president’s supporters can say he’s downplaying the administration’s accomplishments, that he’s just another journalist who has become part of the opposition.

At 77, I suppose, Woodward feels entitled to render this judgment. But the ultimate judgment belongs to those who read the book and weigh Trump’s own words, along with his decision to trust the author.