(a) Proof of the publication of a document or notice required by law, or by an order of court, to be published in a newspaper, may be made by the affidavit of the printer of the newspaper or his foreman or principal clerk, annexed to a copy of the document or notice, specifying the times when and the paper in which the publication was made. Such affidavit must be made within six months after the last day of publication.
(b) If such affidavit is made in an action or proceeding pending in a court, it may be filed with the clerk thereof; and the same is primary evidence of the facts therein stated.