Author Topic: Need help with Layer 'Print When Visible' work-around  (Read 334 times)

Jeff George

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
  • Scribus User
Need help with Layer 'Print When Visible' work-around
« on: September 09, 2016, 01:21:19 am »
When managing layers in a Scribus project, the current version allows layers to be set to "PrintState: ON" or "PrintState: OFF" using the Print checkbox in the Layers dialog box. If "ON" is chosen, the layer will always print; if "OFF" is chosen, it will never print. But there is a third option available to PDF documents: "Print when visible," which causes the layer to print only if the user has that layer set to Visible. This is a tremendously useful feature for allowing the user to customize printed output, and absolutely essential to my current project. It is available in Adobe In-Design, and accessible for users with the free version of Acrobat Reader DC.

After reading through the Scribus issues and bugs, I found that several people have asked for this feature over the past several years, and it has been assigned for implementation in 1.5.3, though it doesn't seem to be there yet. However, one person suggested a workaround, and THAT is what I need help with at the moment:

2012-01-26 17:26   
The required change to the PDF file is a simple one. Omit the line "/PrintState /ON" or "/PrintState /OFF". If neither of these is set, then the layer will print when visible.

I need more specificity about how to "omit the line". I tried opening up the exported .pdf file in a text editor (Sublime Text 2), then searched for and found the /Usage line for each layer, which looked like this:

63 0 obj
/Type /OCG
/Name <FEFF004200610063006B00670072006F0075006E0064>
/Usage <</Print <</PrintState /ON>> /View <</ViewState /ON>>>>

I have tried deleting:
<</PrintState /ON>>
/Print <</PrintState /On>>
/Print <</PrintState /ON>> /View <</ViewState /ON>>
<</Print <</PrintState /ON>> /View <</ViewState /ON>>>>

/Usage <</Print <</PrintState /ON>> /View <</ViewState /ON>>>>

But in each case, when I save the text file and try to open it in Acrobat Reader, the file gives error messages, and displays as mostly blank. Apparently, altering and saving the file in Sublime Text breaks it.

Can anyone give me any more complete information about how to implement Bh's suggested work-around? Do I need to use a different kind of editor to tinker with a .pdf file without breaking it? (A "hex editor" perhaps, whatever that is?)

"Print when visible" is mission-critical to my project; without it, or a working work-around, I'll have to bite the bullet and subscribe to In-Design, or drop the project until Scribus gets around to implementing it. Thanks in advance to anyone who can clarify Bh's advice.


  • Hero Member
  • *****
  • Posts: 1155
  • Country: gb
  • Karma: 18
  • Scribus User
Re: Need help with Layer 'Print When Visible' work-around
« Reply #1 on: September 09, 2016, 02:38:35 pm »
As you've seen, it's usually not a good idea to try and manually edit a "raw" PDF file. PDFs are not like SLAs - which are XML - they're complex files that have all kinds of weird internal dependencies. A PDF is more like a bit of code than a document. Just changing a single character can make the document unusable.

You could have a look at something like jPDFtweak . I've not used it myself but it might be able to do what you need it to do.

P.S. When quoting external sources it's best to include a hyperlink to the page you're quoting from so that people can find the context of the original text. For example, I can't figure out where your quote about "omitting the line" is from so I can't read the full discussion. This makes it very difficult to know what it's saying and why.

P.P.S. It might be good if you can explain more about what your project is and how this function will be used. Someone might be able to supply a workaround if they know what you're trying to do. For example, Acrobat Reader DC lets you change the visibility of layers (as long as the PDF is 1.5 or better); why isn't this enough for what you want to do?


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1063
  • Country: 00
  • Karma: 17
    • the graphics lab
Re: Need help with Layer 'Print When Visible' work-around
« Reply #2 on: September 09, 2016, 05:19:38 pm »
It should be easy to tweak the source code of Scribus to avoid wrting the "PrintState" property.

- get the sources
- search for PrintState
- understand a minimum of the context.
- remove the lines that add the PrintState command (or make it add an empty string)
- compile, install, run, generate a pdf

the next would be to write a bug report ( and ask for the feature to be cleanly compiled.
if you make a good proposal on where and who the option should be available (if possible in a better way than what adobe does :-), and if what you are proposing looks simple to implement, then i'm confident that it will be implemented soon.