Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Page numbers in PDF

    Dear All,

    I am creating a report in PDF directly from Stata with putpdf command.
    I would like to number the pages in the produced document.

    Is there a way to add page numbers and control their appearance (font, style, placement in each section, etc)?

    From this page it appears that this is only possible in Word formatted output, (though it can be converted to PDF subsequently, of course).

    Thank you, Sergiy Radyakin

  • #2
    Dear All,

    I'd like to revert to this question from 2020 to check if any new capabilities that were added to Stata in recent years/versions have enabled producing (with putpdf command) PDF reports with page numbers.

    Thank you, Sergiy

    Comment


    • #3
      Your best bet may be to use pdftk server and some shell commands:

      https://cazencott.info/index.php/pos...ring-PDF-Pages
      https://stackoverflow.com/a/9033109

      It also seems to be possible with ghostscript:

      https://cazencott.info/index.php/pos...ring-PDF-Pages

      Comment


      • #4
        Thank you very much Bert Lloyd !

        These are useful links, however, I am looking for a Stata-native solution, that would not involve dependency on an external tool and be platform-neutral.
        With Excel output I encountered that Mata's xl() is more capable for at least some things then putexcel (though not without its own difficulties), and was hoping for some similar workarounds for putpdf command as well.

        Thank you, Sergiy

        Comment


        • #5
          Yeah, Stata-native would be nice.

          If you have to use a workaround, ghostscript is available for all OS and is FOSS. I haven't used it in a long time, though, so I may be forgetting some complications. You might be able to come up with some tricks using c(os), c(username) and the excellent user-written whereis (by German Rodriguez , https://github.com/grodri/whereis) to get it to work for all your users.

          pdftk server also works on all OS and is free, although not open source. https://www.pdflabs.com/tools/pdftk-server/

          Comment


          • #6
            Sergiy Radyakin,

            One workaround is to use putdocx, which supports page numbers, to export your results to a .docx file. Then use docx2pdf to convert it to a .pdf file.

            Comment

            Working...
            X