Announcement

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

  • Using MATA to create a PDF: how can the PDF file size itself be controlled?

    Dear Statalisters,

    Using the MATA command writepdf I create multiple PDF's. This works well, but I have a huge problem with the footprint of the (one page) PDF that is created by Stata: 58,601Kb!!!
    Next, when I load that PDF in Acrobat Reader and save it under another file name, the file size is reduced to 435Kb, which is huge difference.

    Somehow, Stata is creating obese PDF files.

    Does someone know if some option is required to create a PDF slimmed down to the regular file size?
    http://publicationslist.org/eric.melse

  • #2
    The Mata Reference Manual contains no references to "writepdf". Is this something you wrote yourself? If this is a Mata problem it would be better to ask in the Mata forum.

    Comment


    • #3
      The poster should have referenced this thread, where Hua Peng from Stata walked him through creating writepdf to meet his needs.

      Comment


      • #4
        Dear Friedrich,

        No, I am using the MATA command as documented in the help file [ help mf_pdf ].

        Note that meanwhile, I ran my syntax again and now I do get more 'normal' sized PDF's.
        So, I suspect that some 'last options used' controls of Adobe vis-a-vis the windows registry might be the cause of my problem.
        Certainly something only Stata Corp. can shed more light on.
        http://publicationslist.org/eric.melse

        Comment


        • #5
          Originally posted by ericmelse View Post
          No, I am using the MATA command as documented in the help file [ help mf_pdf ].
          The term "writepdf" does not appear in help mf_pdf. The link in William's post shows that you wrote the function "writepdf", it is not part of Stata.
          Last edited by Friedrich Huebler; 16 Nov 2015, 08:57.

          Comment


          • #6
            Dear Friedrich,

            It is a mata function and the help file does give access to its documentation: help mf_pdf, also it is in Stata's PDF documentation, with examples how to use it, click on [M-5] Pdf*() within the help file page.
            So, I should not be credited with writing that function! (But, I do wish I was that smart!)

            Regards,
            Eric
            http://publicationslist.org/eric.melse

            Comment


            • #7
              Eric - Unfortunately, I'm still on Stata 13.1, so I cannot access the current version of help mf_pdf. However, I downloaded the Stata 14 PDF Mata documentation from the Statacorp web site, and like Friedrich's result, a search of that PDF for "writepdf" as given in the original post does not find any matches. That's hardly definitive; I have had PDF documents that did not respond perfectly to searching.

              If you could give page number references in the Stata 14 Mata PDF for the description of the writepdf command it would help us understand the command you are using, even though we understand your problem seems to have been resolved.

              Comment


              • #8
                Dear William,

                It is documented in the standard m.pdf file that can be accessed from the Stata server [ /manuals14/m.pdf], and scroll through until you are at page 723.

                I think this mata functionality is a brilliant new 'tool in the box' to use Stata as a report generator, something I can use very well.
                However, not being familiar that much with Mata (see my other post) it is somewhat challenging to let this work well (problems with the PDF engine aside).
                http://publicationslist.org/eric.melse

                Comment


                • #9
                  Originally posted by ericmelse View Post
                  It is documented in the standard m.pdf file that can be accessed from the Stata server [ /manuals14/m.pdf], and scroll through until you are at page 723.
                  William and I asked for documentation of the "writepdf" command that you wrote about in your initial post. Page 723 of the Mata Reference Manual does not mention such a command. There is also no mention of "writepdf" in other sections of the Mata Reference Manual. All indications are that you wrote "writepdf" yourself. You have also not posted any code that could be used to reproduce your problem. From the FAQ:

                  Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly! If you can, reproduce the error with one of Stata's provided datasets, a small fragment of your dataset, or a simple concocted dataset that you include in your posting.

                  If you are using user-written commands, explain that and say where where they came from: the Stata Journal, SSC, or other archives. This helps (often crucially) in explaining your precise problem, and it alerts readers to commands that may be interesting or useful to them.
                  I have to bow out here. In any case, I wouldn't be able to help because I am not familiar with Mata.

                  Comment


                  • #10
                    I see nothing on page 723 of the m.pdf file referencing a writepdf command as you discussed in post #1 above. On that and succeeding pages, I see much referencing the PDF*() classes in MATA, which Hau Peng used to create a writepdf command for you in the earlier discussion I referenced in post #3. But to the rest of Statalist the writepdf command will be unfamiliar and undocumented, unless they remember or happen upon the earlier Statalist discussion. Mention of writepdf will only be confusing, as it was to Friedrich and myself, without reference to that discussion.

                    Comment


                    • #11
                      Dear William (and Friedrich),

                      Thank you for pointing this out to me (again), and yes, I now understand what you have been trying to say to me.
                      The "writepdf" code was created by Hau Peng in an earlier post (answering me) and I should not have written in my current post the way I did.
                      I wrongly referred to it as a regular (mata) command.
                      I apologize for any inconvenience that I have caused.

                      Maybe this post better be removed to prevent more confusion...

                      http://publicationslist.org/eric.melse

                      Comment

                      Working...
                      X