보고서 데이터의 PDF 출력 형식을 제어하는 방법을 개발하려고 합니다. 머리글과 바닥글의 서식을 제어하고 로고를 삽입할 수 있도록 하고 싶습니다. 어떻게 접근하면 좋을지 아이디어가 있으시면 알려주세요.
아, 제가 JMP 19에서 여러 페이지로 구성된 PDF 보고서를 만드는 과정에서 겪었던 어려움을 여러분께 알려드리고 싶었어요.
솔직히 말해서, 어느 정도 통제권은 있지만 기대만큼은 아니에요. 저처럼 나중에 후회하는 것보다는 미리 알고 시작하는 게 훨씬 낫죠.
For headers and footers, you've got Set Print Headers(left, center, right) and Set Print Footers(...) to match — three little text slots each. They take plain text plus some handy tokens, so "Page &pn; of &pc;" dropped in the right footer slot gives you "Page 1 of 5" and so on. Works great. But here's what got me: they're 텍스트 전용, and you can't set the font size in the script at all — it secretly follows the "Small" font role tucked away in File ▸ Preferences ▸ Fonts. Took me forever to realize that's why my footer wouldn't shrink. And if you try to stack two lines in one slot, watch out — the \!N newline thing the docs mention straight-up didn't work on my JMP 19 build and silently nuked the entire header. No error, just gone.
Page setup itself is actually solid, no complaints there. Set Page Setup(margins(...), scale(n), portrait(0), paper size("Letter")) handles orientation, margins, scaling, all fine. Just remember to tack on Save PDF(path, Show Page Setup(0)) — that little Show Page Setup(0) shuts off the print dialog popup, which you'll really want once you're cranking out a stack of these unattended.
로고 부분이 좀 까다롭습니다. 머리글과 바닥글은 텍스트만 허용하기 때문에 로고를 넣을 수 없습니다. 따라서 모든 페이지에 로고를 표시하는 기본 기능이 없습니다. 대신 보고서 본문에 그림 상자(picture box)로 로고를 넣고, base64 형식으로 인코딩하면 별도의 이미지 파일을 들고 다닐 필요가 없습니다.
<SPAN>Picture Box( New Image( Char To Blob( logoB64, "base64" ), "png" ) )</SPAN>
Park that at the top of your outer V List Box and boom, you've got a letterhead — but page 1 only, 'cause the body just renders wherever it lands.
만약 모든 페이지에 로고를 꼭 넣어야 한다면, 솔직히 말씀드리자면 JMP 19 자체 기능으로는 불가능합니다. 제가 사용한 방법은 두 단계입니다. 먼저 JMP로 PDF를 생성한 다음, 간단한 스크립트를 실행하여 모든 페이지에 로고를 삽입합니다. 파이썬의 pypdf나 reportlab 라이브러리를 사용하면 몇 줄의 코드로 폴더 전체에 로고를 적용할 수 있습니다. 보기에는 예쁘지 않지만, 매우 안정적이며, 한 번 설정해 놓으면 로고가 있다는 사실조차 잊어버릴 정도입니다.
요약하자면, JMP 19는 데이터 편집에는 훌륭하고, 괜찮은 텍스트 머리글/바닥글과 페이지 설정, 그리고 1페이지에 로고를 넣는 기능까지 제공합니다. 하지만 페이지별 이미지 삽입이나 스크립트에서 글꼴을 제어하는 기능은 없습니다. 모든 페이지에 로고를 넣는 것이 필수라면, 저처럼 JMP에서 모든 기능을 구현하려고 애쓰지 말고, JMP에서 PDF를 생성한 후 로고를 직접 추가하는 방법을 고려해 보세요.