More than 80 years before JK Rowling testified to the Leveson inquiry into press standards that paparazzi attention left her feeling "under siege or like a hostage", James Joyce was writing to his son about the reporter "posted on the steps" outside his London home at midnight.

In a letter written on 9 July 1931 and published for the first time in digital form by the National Library of Ireland (NLI), the author describes to his son Giorgio and his daughter-in-law Helen how the press pursued him over details of his wedding to Nora Barnacle five days earlier. Joyce had been living with Nora for nearly 27 years – according to Ian Pindar's biography of the author, he "regarded wedding rings as symbols of slavery" – but the pair were legally married in 1931 to "legitimise [his children] in the eyes of the law".

The letter, which belongs to the Zurich James Joyce Foundation, shows how reporters went to great lengths to discover details of the ceremony Joyce had tried to keep a secret. The author told his son that anyone who thinks he married as "a publicity stunt he must be a congenital imbecile".

Joyce writes of how a "Press Association man" stopped him in Kensington's Campden Grove. "I was eating marchpane at the time out of my pocket and went on eating so as to gain time," he writes. "He went on to say he had been sent to me for a statement as to why if I married N.B. in 1904, I was etc etc. Having finished the marchpane I asked him upstairs."

The reporter repeatedly asked Joyce for a statement, but Joyce referred him to his solicitor, only to find himself the subject of a stream of press requests. "All day the bell went and the telephone. Even at midnight when we came back from supper there was a reporter posted on the steps. All got the same answer," he continued.

The most persistent was from a Sunday Express writer who tricked his way into the novelist's house on the day of the wedding: "he said he had been sent to inspect the register in which Nora was described as a 'spinster'", and to ask Joyce for a comment. The author declined, again referring the reporter to his solicitor, but the journalist soon returned with a message from his editor.

"It was pure blackmail," Joyce told his son. "They offered me half the middle page if I would write an article for the next day on Modern Marriage and Free Love, and he gave me to understand If I did I would be well paid and if I did not the paper would hold itself free to deal with my 'double marriage' as it pleased."

The reporter received short shrift from Joyce, who "told him to inform his editor that I did not write for the press and did not read it either".

Joyce told his son that "the story that we are to stand by is that there was a marriage in 1904 in Austria invalid for some reason I shall proceed to invent". The eventual statement to press was that Nora had given a false name, making the marriage invalid, and that they were now marrying for "testamentary reasons", according to Gordon Bowker's biography.

This didn't convince: The Mirror "was quick to sniff a scandal", writes Bowker, quoting the paper saying that "according to Who's Who he was married in 1904 to Miss Nora Barnacle of Galway".

The letter is one of 90 bequeathed to the Zurich foundation by Professor Hans E Jahnke, the son of Giorgio Joyce's second wife, Dr Asta Osterwalder Joyce, and made available digitally in some jurisdictions for the first time.

"The letters in the Joyce Foundation, mainly addressed to George Joyce (in Italian) and to Helen Joyce (Fleischman, in English), dealing largely with family matters, have some mainly biographical relevance, the ones to Helen Joyce also contain remarks on Joyce's work. The Foundation is also in collaboration with a project to publish all extant letters of Joyce – something that is overdue anyway," said the foundation's Fritz Senn.

The decision to digitise its Joyce material was taken partly to make it available to scholars and readers, Senn continued, but also after an "unfortunate experience" with Ithys Press who published part of a Joyce letter without the foundation's "permission or even knowledge" as the children's story The Cats of Copenhagen.

"To have the material available on the internet would prevent any more of such acts," Senn said.