6 Replies Latest reply on May 22, 2012 5:36 PM by pbear*

    Preserving code formatting in PDF Export

    pbear*

      I'm working on a project where there are code samples in the final PDF. The end user will at times select-copy-paste these from the document into their text editor to play with. The code would be like the following sample—in a monospace typeface with leading spaces:

       

      <!doctype html>
        <head>
          <title>A Basic Website</title>
        </head>
        <body>
          <h1>The Header</h1>
          <p>The text.</p>
        </body>
      </html>

       

      I have also tried using non-breaking spaces (cmd-opt-X) and tab characters, but in the PDF the initial spaces essentially get transformed into indents.

       

      I've also considered some kind of button to copy formatted text to the clipboard, but it seems all I can do (at least with CS5) is open an external file in an external editor, which starts to get fussy.

       

      Is there a way to preserve these characters in the Export to PDF process? I'm not seeing any setting in Preferences, Export dialog or in Acrobat.

       

      using: InDesign CS5 & Acrobat 9.0 on Mac 10.6 Snow Leopard.