Announcement

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

  • Landscape orientation from translate smcl2pdf?

    Dear Statalist,

    I am trying to convert a log-file from smcl to pdf, with the resulting PDF in landscape orientation.

    Perusing the options listed by -translator query smcl2pdf-, I had thought this would be possible by setting some combination of pagesize, pageheight and pagewidth, since all are listed as options:
    pagesize | letter
    pagewidth | 8.50
    pageheight | 11.00

    However, I have not been successful using various combinations of options and guesses at options. For example

    pagesize(custom) pagewidth(11.00) pageheight(8.50)
    produces
    option pagewidth() not allowed
    r(198);

    pagesize(landscape)
    produces
    pagesize "landscape" invalid

    as do other guesses such as letter-landscape.

    I have two questions, one specific and one more general:

    First, how can I solve this narrow problem and produce a pdf in landscape format?

    Second, are there any general resources such as a list of allowed parameters (and combinations of parameters), working examples, etc?

    Many thanks,

    BL

    PS: Stata 13.1 SE-64 on W7.
    Last edited by Bert Lloyd; 03 Jul 2014, 11:00.

  • #2
    Am not sure why including the override_options for -translate- does not work (I can reproduce your error). But alternatively setting these options with the -translator set smcl2pdf <option>- command before using the -translate- command does seem to work.

    I have a personal ado-file that I've written for the purpose of opening and closing smcl logs and converting them to pdf files on closing. It includes a landscape option which changes the 3 translator settings you used:
    Code:
    if "`landscape'" ~= "" {
                translator set smcl2pdf pagesize custom
                translator set smcl2pdf pagewidth 11.0
                translator set smcl2pdf pageheight 8.5
            }
    fyi, but not entirely necessary - I also include the following translator settings/commands in my -pdflog- program:
    Code:
    translator set smcl2pdf logo off
    translator set smcl2pdf fontsize 8
    translator set smcl2pdf lmargin 0.4
    translator set smcl2pdf rmargin 0.4
    translator set smcl2pdf tmargin 0.4
    translator set smcl2pdf bmargin 0.4
    translator set smcl2pdf headertext "`fname'.pdf"
    
    translate ${tdrf}`fname'.smcl ${tdrf}`fname'.pdf, `replace' cmdnumber(off)
    
    translator reset smcl2pdf
    where `fname' and `replace' are options/arguments to the -pdflog- ado, and ${tdrf} references the global macro that holds the path of the temp directory I use to dump all results into.

    - Gary

    Comment


    • #3
      Dear Gary,

      Thanks very much, your suggestion works very well.

      Did you discover this through trial and error or do you know of any resource with a comprehensive list of allowed options?

      Best,

      BL
      Last edited by Bert Lloyd; 05 Jul 2014, 07:16.

      Comment


      • #4
        Hi Bert,

        I used the same command that you did to find out which translator settings were available: -translator query smcl2pdf-. I am not aware of a resource which provides the actual allowed options for each of these settings. Though the options for most seem to be easy to infer from the setting name, those for settings such as pagesize() are not.

        I think that I stumbled across the fact that pagesize(custom) needed to be specified before setting the pagewidth() and pageheight() settings when somehow directed to -help ps_options-.
        Prior to the availability of smcl2pdf I had used smcl2ps to generate pdf log files by converting the resulting ps files to pdf with Ghostscript ps2pdf (under Windows 7). Unfortunately the postscript files generated by smcl2ps using the above combination of landscape translator settings do not result in landscape pdf files when Ghostcript's ps2pdf is then used. I don't know if this is a problem with the ps2pdf program, with Stata's smcl2ps translator, or my own error in specifying options for either/both. I suspect it is a problem with the smcl2ps translator.

        Until enlightened otherwise, I am considering the failure of the -translate- command to directly accept -,pagesize(custom) pagewidth(11.0) pageheight(8)- - for either smcl to pdf conversion or smcl to ps conversion - to be a bug.

        - Gary

        Comment


        • #5
          Gary, thanks again.

          If Statacorp is listening: it would be great have a bit more detail on what can be done with the translator.

          Best,
          BL

          Comment


          • #6
            Thanks to Gary for his solution to the broken override options on the -smcl2pdf- translator. A question and a request.

            Question:

            In response to translator query smcl2pdf, one sees:

            -----------------------+-------------------------------------------------
            fontsize | 9 lmargin | 1.00
            pagesize | letter rmargin | 1.00
            pagewidth | 8.50 tmargin | 1.00
            pageheight | 11.00 bmargin | 1.00
            -----------------------+-------------------------------------------------
            scheme | monochrome
            -----------------------+-------------------------------------------------


            Have you (or has anyone else) discovered whether there are options for "scheme" that are different than "monochrome"?

            Request:

            I realize that your post above contains the key logic for your personal ado file, -pdflog-. But please post it anyway. Perhaps the commmunity can think of ways to improve it.

            Thanks,

            Mead

            Comment


            • #7
              If I remember correctly, it is only "color" and "monochrome". See old post here: https://www.statalist.org/forums/for...19#post1331119
              Stata/MP 14.1 (64-bit x86-64)
              Revision 19 May 2016
              Win 8.1

              Comment

              Working...
              X